Пример #1
0
		internal static void InjectDropInvButton() {
			var invManager = UIInventoryManager.Instance.gameObject.ChildPath("InventoryWindow/UnlitContent/StuffBar");
			if (_dropButton.IsAlive()) return;
			var craftButton = invManager.Child("Craft").Component<UIMultiSpriteImageButton>();
			craftButton.transform.localPosition += new Vector3(0, 25, 0);
			craftButton.transform.localScale = new Vector3(0.82f, 0.82f, 0.82f);

			_dropButton = new QuickButton(craftButton.transform.parent, "DropButton", craftButton.gameObject, false) {
				LocalScale = craftButton.transform.localScale,
				LocalPosition = craftButton.transform.localPosition.Plus(y: -50f),
				Caption = "Drop Items"
			};
			_dropButton.ButtonComponent.Label.multiLine = false;
			_dropButton.ButtonComponent.Label.shrinkToFit = true;
			_dropButton.Click += x => DropInventory();
		}
Пример #2
0
		protected virtual void RaisePress(QuickButton arg1, bool arg2) {
			var handler = Press;
			handler?.Invoke(arg1, arg2);
		}
Пример #3
0
		protected virtual void RaiseClick(QuickButton obj) {
			
			var handler = Click;
			handler?.Invoke(obj);
		}
Пример #4
0
		public static void Initialize() {
			
			//Note that the game will destroy the UI when you go to the main menu, so we'll have to rebuild it.
			//The best way to check if we need to initialize everything seem to be the following, though it's strange messy.
			if (IsInitialized) { return; }

			//This is the 'Customize UI' button that lets you customize the UI.
			_customizeButton = new QuickButton(UIPartyPortraitBar.Instance.transform.parent) {
				Caption = "Customize UI",
				Name = "CustomizeUI",
				LocalPosition = new Vector3(903.5f, 76.2f, 0f),
				LocalScale = new Vector3(0.7f, 0.7f, 1f)
			};

			_customizeButton.Click += x => {
				SaveLayout(IEModOptions.Layout);
				ShowInterface(!IsInterfaceVisible);
			};

			DefaultActionBarAtlas =
				Attack.Child(0).Component<UISprite>().atlas.spriteMaterial.mainTexture;

			//these may break in future version changes, but I doubt they'll break much.
			//since changing them will probably break some of the developer's code as well
			//to fix them, dump the UICamera hierarchy to file and see which names changed.
			//using Child(string) also tells you which names are broken because it throws an exception if it can't find something,
			//instead of silently returning null and letting you figure out where the problem came from.
			if (DefaultLayout == null) {
				DefaultLayout = new IEModOptions.LayoutOptions();
				SaveLayout(DefaultLayout);
			}

	

			// turning off BB-version label in the upper right corner, cause it's annoying when you want to move portraits there
			UiCamera.Child("BBVersion").gameObject.SetActive(false);

			// UIAnchors on the ActionBarWindow that prevent it from being moved... (it's related to the partybar somehow?)
			// HUD -> Bottom -> ActionBarWindow -> destroy 3 UIAnchors
			foreach (var comp in ActionBarWindow.Components<UIAnchor>()) {
				GameUtilities.DestroyComponent(comp);
			}

			var component = ConsoleWindow.Component<UIAnchor>();
			if (component) {
				GameUtilities.DestroyComponent(component);
			}

			// disable the minimize buttons for the log and the actionbar
			Bottom.Child("ConsoleMinimize").SetActive(false);
			Bottom.Child("ActionBarMinimize").gameObject.SetActive(false);

			// this UIPanel used to hide the clock when it was moved from far away from its original position
			// HUD -> Bottom -> ActionBarWindow -> ActionBarExpandedAnchor -> UIPanel
			ActionBarWindow.Component<UIPanel>().clipping = UIDrawCall.Clipping.None;
			
			// detaches the "GAME PAUSED" and "SLOW MO" from the Clock panel, to which it was attached for some reason...
			var gamePausedAnchors = UiCamera.Child("GamePaused").Components<UIAnchor>();
			gamePausedAnchors[0].widgetContainer = Hud.Component<UIPanel>().widgets[0];
			gamePausedAnchors[1].DisableY = true;
			var slowMoAnchors = UiCamera.Child("GameSpeed").Components<UIAnchor>();
			slowMoAnchors[0].widgetContainer = Hud.Component<UIPanel>().widgets[0];
			slowMoAnchors[1].DisableY = true;
			PartyBar.AddChild(new GameObject("IsInitialized"));
		}
Пример #5
0
        protected virtual void RaisePress(QuickButton arg1, bool arg2)
        {
            var handler = Press;

            handler?.Invoke(arg1, arg2);
        }
Пример #6
0
        protected virtual void RaiseClick(QuickButton obj)
        {
            var handler = Click;

            handler?.Invoke(obj);
        }