25 public static string fName =
"ComponentGui";
169 "OnModalPanelWidgetSet",
183 public virtual void DisplayLargeMessage(
string largeText,
string smallText,
float duration,
float delay) {
207 if (playNotificationSound) {
228 modLoader.GuiUpdate(
this);
291 GameMode gameMode = worldSettings.GameMode;
292 bool isCreative = gameMode ==
GameMode.Creative;
293 m_creativeFlyButtonWidget.IsVisible = isCreative;
294 m_timeOfDayButtonWidget.IsVisible = isCreative;
295 m_lightningButtonWidget.IsVisible = isCreative;
296 m_precipitationButtonWidget.IsVisible = isCreative && worldSettings.AreWeatherEffectsEnabled;
297 m_fogButtonWidget.IsVisible = isCreative && worldSettings.AreWeatherEffectsEnabled;
299 bool adventureEnabled = worldSettings.AreAdventureSurvivalMechanicsEnabled;
300 HealthBarWidget.IsVisible = !isCreative;
301 FoodBarWidget.IsVisible = !isCreative && adventureEnabled;
302 TemperatureBarWidget.IsVisible = !isCreative && adventureEnabled;
303 LevelLabelWidget.IsVisible = !isCreative && adventureEnabled;
331 float targetSidePanelsFactor = (
ShowTouchWidget | showModelWidget) ? 0 : 1;
333 if (MathF.Abs(x) > 0.01f) {
355 float num = 0.5f + 0.5f * MathF.Pow(1f - factor, 0.1f);
356 float num2 = 0.5f + 0.5f * MathF.Pow(factor, 0.1f);
357 float s = 1f - factor;
361 m_modalPanelAnimationData.OldWidget.ColorTransform = Color.White * s;
362 m_modalPanelAnimationData.OldWidget.RenderTransform =
369 m_modalPanelAnimationData.NewWidget.ColorTransform = Color.White * s2;
370 m_modalPanelAnimationData.NewWidget.RenderTransform =
386 m_modalPanelAnimationData.NewWidget.ColorTransform =
Color.
White;
387 m_modalPanelAnimationData.NewWidget.RenderTransform =
Matrix.
Identity;
404 m_largeMessageWidget.IsVisible =
true;
409 labelWidget.IsVisible = !
string.IsNullOrEmpty(
m_message.LargeText);
410 labelWidget2.IsVisible = !
string.IsNullOrEmpty(
m_message.SmallText);
411 float num = (float)Math.Min(
415 labelWidget.Color =
new Color(num, num, num, num);
416 labelWidget2.Color =
new Color(num, num, num, num);
422 m_largeMessageWidget.IsVisible =
false;
424 ControlsContainerWidget.IsVisible = m_componentPlayer.PlayerData.IsReadyForPlaying
425 && m_componentPlayer.GameWidget.ActiveCamera.IsEntityControlEnabled
426 && componentSleep.SleepFactor <= 0f;
438 m_lookRectangleContainerWidget.IsVisible = flag;
447 m_moveRectangleWidget.FlipHorizontal =
true;
448 m_lookRectangleWidget.FlipHorizontal =
false;
453 m_moveRectangleWidget.FlipHorizontal =
false;
454 m_lookRectangleWidget.FlipHorizontal =
true;
460 m_crouchButtonWidget.IsChecked = m_componentPlayer.ComponentBody.TargetCrouchFactor > 0f;
461 m_creativeFlyButtonWidget.IsChecked =
m_componentPlayer.ComponentLocomotion.IsCreativeFlyEnabled;
466 m_crouchButtonWidget.IsVisible =
false;
467 m_mountButtonWidget.IsVisible =
false;
468 m_editItemButton.IsVisible =
true;
470 else if (componentRider !=
null
471 && componentRider.
Mount !=
null) {
472 m_crouchButtonWidget.IsVisible =
false;
473 m_mountButtonWidget.IsChecked =
true;
474 m_mountButtonWidget.IsVisible =
true;
475 m_editItemButton.IsVisible =
false;
478 m_mountButtonWidget.IsChecked =
false;
479 if (componentRider !=
null
483 m_crouchButtonWidget.IsVisible =
false;
484 m_mountButtonWidget.IsVisible =
true;
485 m_editItemButton.IsVisible =
false;
488 m_crouchButtonWidget.IsVisible =
true;
489 m_mountButtonWidget.IsVisible =
false;
490 m_editItemButton.IsVisible =
false;
501 m_componentPlayer.ComponentGui.HealthBarWidget.LitBarColor =
new Color(166, 175, 103);
504 m_componentPlayer.ComponentGui.HealthBarWidget.LitBarColor = m_componentPlayer.ComponentFlu.HasFlu
505 ?
new Color(0, 48, 255)
506 :
new Color(224, 24, 0);
559 "ClothingWidgetOpen",
561 modLoader.ClothingWidgetOpen(
this, clothingWidget);
572 m_componentPlayer.ComponentBody.TargetCrouchFactor = 1f;
577 m_componentPlayer.ComponentBody.TargetCrouchFactor = 0f;
581 if (componentRider !=
null
583 bool flag = componentRider.Mount !=
null;
589 if (componentMount !=
null) {
593 if (componentRider.
Mount !=
null != flag) {
614 if (inventory !=
null) {
628 && componentRider.
Mount ==
null) {
629 bool isCreativeFlyEnabled =
m_componentPlayer.ComponentLocomotion.IsCreativeFlyEnabled;
630 m_componentPlayer.ComponentLocomotion.IsCreativeFlyEnabled = !isCreativeFlyEnabled;
631 if (
m_componentPlayer.ComponentLocomotion.IsCreativeFlyEnabled != isCreativeFlyEnabled) {
633 m_componentPlayer.ComponentLocomotion.JumpOrder = 1f;
693 m_subsystemTimeOfDay.TimeOfDayOffset += num2;
696 else if (num3 == num6) {
697 m_subsystemTimeOfDay.TimeOfDayOffset += num3;
700 else if (num4 == num6) {
701 m_subsystemTimeOfDay.TimeOfDayOffset += num4;
704 else if (num5 == num6) {
705 m_subsystemTimeOfDay.TimeOfDayOffset += num5;
733 if (inventory !=
null) {
748 modloader.GuiDraw(
this, camera, drawOrder);
static int Min(int x1, int x2)
static float Saturate(float x)
static float PowSign(float x, float n)
static float FrameDuration
static bool PeriodicEvent(double period, double offset)
static double FrameStartTime
virtual bool IsEditable_(int value)
ContainerWidget m_moveRectangleContainerWidget
GamepadHelpDialog m_gamepadHelpDialog
virtual bool IsClothingVisible()
RectangleWidget m_lookRectangleWidget
ButtonWidget m_editItemButton
virtual void UpdateWidgets()
SubsystemAudio m_subsystemAudio
ButtonWidget m_inventoryButtonWidget
ButtonWidget m_fogButtonWidget
SubsystemBlockBehaviors m_subsystemBlockBehaviors
ContainerWidget m_moveButtonsContainerWidget
ContainerWidget m_lookContainerWidget
ValueBarWidget TemperatureBarWidget
RectangleWidget m_moveRectangleWidget
virtual void DisplaySmallMessage(string text, Color color, bool blinking, bool playNotificationSound)
ButtonWidget m_photoButtonWidget
Widget m_moreContentsWidget
ContainerWidget ControlsContainerWidget
ComponentInput m_componentInput
virtual void Update(float dt)
virtual bool IsInventoryVisible()
LabelWidget LevelLabelWidget
ButtonWidget m_cameraButtonWidget
SubsystemWeather m_subsystemWeather
ButtonWidget m_clothingButtonWidget
ButtonWidget m_mountButtonWidget
ShortInventoryWidget ShortInventoryWidget
ButtonWidget m_crouchButtonWidget
ContainerWidget m_movePadContainerWidget
ButtonWidget m_precipitationButtonWidget
virtual bool ShowTouchWidget
ContainerWidget m_lookRectangleContainerWidget
ButtonWidget m_helpButtonWidget
SubsystemTerrain m_subsystemTerrain
override void OnEntityRemoved()
ContainerWidget m_lookPadContainerWidget
virtual void DisplaySmallMessage(MessageWidget.Message message, bool playNotificationSound)
模组如果需要自定义类型的DisplaySmallMessage,比如彩虹渐变色的Message,可以自己建立对应的Message类型,并调用这个方法
override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
bool m_keyboardHelpMessageShown
ContainerWidget m_largeMessageWidget
ModalPanelAnimationData m_modalPanelAnimationData
TouchInputWidget LookWidget
virtual void DisplaySmallMessage(string text, Color color, bool blinking, bool playNotificationSound, float fontScale=1f)
SubsystemSky m_subsystemSky
ButtonWidget m_creativeFlyButtonWidget
ButtonWidget m_moreButtonWidget
virtual void UpdateSidePanelsAnimation()
SubsystemGameInfo m_subsystemGameInfo
KeyboardHelpDialog m_keyboardHelpDialog
ButtonWidget m_backButtonWidget
ContainerWidget m_leftControlsContainerWidget
ValueBarWidget FoodBarWidget
ContainerWidget m_rightControlsContainerWidget
bool m_gamepadHelpMessageShown
MoveRoseWidget MoveRoseWidget
override void OnEntityAdded()
ContainerWidget m_moveContainerWidget
ComponentPlayer m_componentPlayer
ValueBarWidget HealthBarWidget
virtual bool IsGameMenuDialogVisible()
virtual void Draw(Camera camera, int drawOrder)
override void Save(ValuesDictionary valuesDictionary, EntityToIdMap entityToIdMap)
virtual void HandleInput()
MessageWidget m_messageWidget
virtual void EndModalPanelAnimation()
virtual void UpdateModalPanelAnimation()
virtual void DisplayLargeMessage(string largeText, string smallText, float duration, float delay)
ContainerWidget m_modalPanelContainerWidget
static Func< Widget > OpenClothingWidget
double m_lastMountableCreatureSearchTime
TouchInputWidget ViewWidget
virtual bool IsActiveSlotEditable()
SubsystemTimeOfDay m_subsystemTimeOfDay
ButtonWidget m_lightningButtonWidget
TouchInputWidget MoveWidget
ButtonWidget m_timeOfDayButtonWidget
virtual ComponentMount FindNearestMount()
virtual void StartMounting(ComponentMount componentMount)
virtual void StartDismounting()
static ReadOnlyList< Dialog > Dialogs
static void ShowDialog(ContainerWidget parentWidget, Dialog dialog)
static float Interval(float t1, float t2)
static string Get(string className, int key)
获取在当前语言类名键对应的字符串
static void CapturePhoto(Action success, Action< Exception > failure)
static float FinalUiScale
static void SwitchScreen(string name, params object[] parameters)
static MoveControlMode MoveControlMode
static LookControlMode LookControlMode
static float MoveWidgetMarginX
static float MoveWidgetMarginY
static bool HideMoveLookPads
static bool LeftHandedLayout
virtual bool OnEditBlock(int x, int y, int z, int value, ComponentPlayer componentPlayer)
virtual bool OnEditInventoryItem(IInventory inventory, int slotIndex, ComponentPlayer componentPlayer)
static int ExtractContents(int value)
ValuesDictionary ValuesDictionary
static void HookAction(string HookName, Func< ModLoader, bool > action)
执行Hook
int GetSlotValue(int slotIndex)
static Matrix CreateFromQuaternion(Quaternion quaternion)
static Matrix CreateTranslation(float x, float y, float z)
static readonly Matrix Identity
static Matrix CreateScale(float scale)