Example #1
0
        //This function is used to generate the content in the "Mods" section of the options window
        //The behaviors array contains all behaviours that have been spawned for this mod, one for each implementation
        public void ConstructOptionsScreen(RectTransform parent, ModBehaviour[] behaviours)
        {
            //Start by spawning a label
            var label = WindowManager.SpawnLabel();

            label.text = "Server Monitor is a simple monitoring utility to show server utilization.";
            //Add the label to the mod panel at (0, 0) with 96 width and 32 height, anchored to the top left
            WindowManager.AddElementToElement(label.gameObject, parent.gameObject, new Rect(0, 0, 390, 64),
                                              new Rect(0, 0, 0, 0));

            //Add an inputfield where the user can write text to change the maximum floor level
            //var inputField = WindowManager.SpawnInputbox();
            ////We need a reference to a behavior to read and write from the mod settings file
            //var floorBehavior = behaviours.OfType<FloorBehaviour>().First();
            //inputField.text = floorBehavior.LoadSetting("MaxFloor", 20).ToString();
            //inputField.onValueChange.AddListener(x =>
            //{
            //    try
            //    {
            //        var max = Convert.ToInt32(x);
            //        floorBehavior.MaxFloor = max;
            //        //Settings are saved to a text file with the dll, all ModBehaviours has a function to do this
            //        floorBehavior.SaveSetting("MaxFloor", max.ToString());
            //    }
            //    catch (Exception)
            //    {
            //    }
            //});
            //WindowManager.AddElementToElement(inputField.gameObject, parent.gameObject, new Rect(100, 0, 96, 32),
            //    new Rect(0, 0, 0, 0));
        }
        public override void ConstructOptionsScreen(RectTransform parent, bool inGame)
        {
            Text label = WindowManager.SpawnLabel();

            label.text = "Created by Designer225 using Harmony Patch Library by Andreas Pardeike.\n" +
                         "Buffs skill gains from education to make them seem less useless. Useful\n" +
                         "for mods that add a lot of specialization fields.\n\n";

            WindowManager.AddElementToElement(label.gameObject, parent.gameObject, new Rect(0, 0, label.preferredWidth, label.preferredHeight),
                                              new Rect(0, 0, 0, 0));

            Text text = WindowManager.SpawnLabel();

            text.text = "Enter the desired number of months required to max out a skill (up to 4 characters including dots):";
            WindowManager.AddElementToElement(text.gameObject, parent.gameObject, new Rect(0, label.preferredHeight, text.preferredWidth, text.preferredHeight), new Rect(0, 0, 0, 0));

            InputField input = WindowManager.SpawnInputbox();

            input.lineType            = InputField.LineType.SingleLine;
            input.characterValidation = InputField.CharacterValidation.Decimal;
            input.characterLimit      = 4;
            input.text = EducationBuffBehavior.MonthsToMaxOut.ToString();
            input.onEndEdit.AddListener(newValue =>
            {
                if (!float.TryParse(newValue, out float result))
                {
                    return;
                }
                EducationBuffBehavior.MonthsToMaxOut = result;
            });
            WindowManager.AddElementToElement(input.gameObject, parent.gameObject, new Rect(0, text.preferredHeight + label.preferredHeight, 100, 28), new Rect(0, 0, 0, 0));
        }
        public override void ConstructOptionsScreen(RectTransform parent, bool inGame)
        {
            Text text = WindowManager.SpawnLabel();

            text.text = "Created by DNA\n\nAllows for wider modification of starting conditions.";
            WindowManager.AddElementToElement(text.gameObject, parent.gameObject, new Rect(0f, 0f, 400f, 128f),
                                              new Rect(0f, 0f, 0f, 0f));
        }
Example #4
0
        public override void ConstructOptionsScreen(RectTransform parent, bool inGame)
        {
            Button e = WindowManager.SpawnButton();

            e.onClick.AddListener(ErrorTest);
            e.SetText("Test Error");
            WindowManager.AddElementToElement(e.gameObject, parent.gameObject, new Rect(0, 15, 192, 64), Rect.zero);
        }
Example #5
0
        public override void ConstructOptionsScreen(RectTransform parent, bool inGame)
        {
            Text text = WindowManager.SpawnLabel();

            text.text = "Created by mladjo97";
            WindowManager.AddElementToElement(text.gameObject, parent.gameObject, new Rect(0f, 0f, 400f, 128f),
                                              new Rect(0f, 0f, 0f, 0f));
        }
Example #6
0
		public override void ConstructOptionsScreen(RectTransform parent, bool inGame)
		{
			Text label = WindowManager.SpawnLabel();
			label.text = "Please load a game and press 'Trainer' button.";

			WindowManager.AddElementToElement(label.gameObject, parent.gameObject, new Rect(0, 0, 400, 128),
					new Rect(0, 0, 0, 0));
		}
Example #7
0
        private void CreateButton()
        {
            GameObject FanPanel = WindowManager.FindElementPath("MainPanel/Holder/FanPanel").gameObject;

            MPButton = WindowManager.SpawnButton();
            MPButton.onClick.AddListener(CreateBaseMultiplayerWindow);
            MPButton.SetText("MultiplayerButton".LocDef("Multiplayer"));
            WindowManager.AddElementToElement(MPButton.gameObject, FanPanel, new Rect(274, 0, 100, 32), Rect.zero);
            Logging.Info("Initalized multiplayer button in MainScene");
        }
Example #8
0
        public void ConstructOptionsScreen(RectTransform parent, ModBehaviour[] behaviours)
        {
            Text label = WindowManager.SpawnLabel();

            label.text = "Created by LtPain, edit by Trawis\n\n" +
                         "Options have been moved to the Main Screen of the game.\n" +
                         "Please load a game and press 'Trainer' button.";

            WindowManager.AddElementToElement(label.gameObject, parent.gameObject, new Rect(0, 0, 400, 128),
                                              new Rect(0, 0, 0, 0));
        }
Example #9
0
        public static void CreateTrainerButton()
        {
            TrainerButton = WindowManager.SpawnButton();
            TrainerButton.GetComponentInChildren <Text>().text = "Trainer " + Version;
            TrainerButton.onClick.AddListener(() => SettingsWindow.Show());
            TrainerButton.name = "TrainerButton";

            WindowManager.AddElementToElement(TrainerButton.gameObject,
                                              WindowManager.FindElementPath("MainPanel/Holder/FanPanel").gameObject, new Rect(164, 0, 100, 32),
                                              new Rect(0, 0, 0, 0));
        }
Example #10
0
        public static void AttachSkillChangeButtonToEmployeeWindow()
        {
            SkillChangeButton = WindowManager.SpawnButton();
            SkillChangeButton.GetComponentInChildren <Text>().text = "Skill Change";
            SkillChangeButton.onClick.AddListener(() => EmployeeSkillChangeWindow.Show());
            SkillChangeButton.name = "EmployeeSkillButton";

            WindowManager.AddElementToElement(SkillChangeButton.gameObject,
                                              WindowManager.FindElementPath("ActorWindow/ContentPanel/Panel").gameObject, new Rect(0, 0, 100, 32),
                                              new Rect(0, 0, 0, 0));
        }
Example #11
0
 public override void ConstructOptionsScreen(RectTransform parent, bool inGame)
 {
     if (inGame)
     {
         //Start by spawning a label
         var label = WindowManager.SpawnLabel();
         label.text = "SIncLib v" + Version + " was created by Otters Pocket. GitHub @ https://github.com/realworld666/SIncLib";
         WindowManager.AddElementToElement(label.gameObject, parent.gameObject, new Rect(0, 0, 400, 75),
                                           new Rect(0, 0, 0, 0));
     }
 }
Example #12
0
        public static void Button()
        {
            Button btn = WindowManager.SpawnButton();

            btn.GetComponentInChildren <Text>().text = $"Trainer {version}";
            btn.onClick.AddListener(() => SettingsWindow.Show());

            WindowManager.AddElementToElement(btn.gameObject,
                                              WindowManager.FindElementPath("MainPanel/Holder/FanPanel").gameObject, new Rect(164, 0, 100, 32),
                                              new Rect(0, 0, 0, 0));
        }
Example #13
0
        public override void ConstructOptionsScreen(RectTransform parent, bool inGame)
        {
            _text      = WindowManager.SpawnLabel();
            _text.text = "Created with love by MarioGK.";

            /*_toggle = WindowManager.SpawnCheckbox();
             * _toggle.name = "Enabled";
             * WindowManager.AddElementToElement(_toggle.gameObject, parent.gameObject, new Rect(0f, 0f, 380f, 128f),
             *  new Rect(0f, 0f, 0f, 0f));*/
            WindowManager.AddElementToElement(_text.gameObject, parent.gameObject, new Rect(0f, 24f, 120f, 42f),
                                              new Rect(0f, 0f, 0f, 0f));
        }
Example #14
0
        public static void SpawnButton()
        {
            btn = WindowManager.SpawnButton();
            btn.GetComponentInChildren <Text>().text = "SIncLib";
            btn.onClick.AddListener(Show);
            btn.name = "SIncLibButton";

            WindowManager.AddElementToElement(btn.gameObject,
                                              WindowManager.FindElementPath("MainPanel/Holder/FanPanel").gameObject,
                                              new Rect(264, 0, 100, 32),
                                              new Rect(0, 0, 0, 0));
        }
Example #15
0
        public void ConstructOptionsScreen(RectTransform parent, ModBehaviour[] behaviours)
        {
            var versionLabel = WindowManager.SpawnLabel();

            versionLabel.text      = "Version " + Version;
            versionLabel.fontSize += 4;
            WindowManager.AddElementToElement(versionLabel.gameObject, parent.gameObject, new Rect(2, 2, 256, 48), new Rect(0, 0, 0, 0));
            InfoText = WindowManager.SpawnLabel();
            var status = InfoText.gameObject.AddComponent <ModStatusText>();

            status.Loader = behaviours.OfType <FurnitureLoader>().First();
            WindowManager.AddElementToElement(InfoText.gameObject, parent.gameObject, new Rect(2, 48, 512, 512), new Rect(0, 0, 0, 0));
        }
        public GUIWindow CreateWindow(string label, List <GameObject> content)
        {
            var wnd = WindowManager.SpawnWindow();

            wnd.Title       = "";
            wnd.StartHidden = true;
            wnd.OnlyHide    = true;

            var serverLabel = WindowManager.SpawnLabel();

            serverLabel.text = label;
            WindowManager.AddElementToElement(serverLabel.gameObject, wnd.gameObject, new Rect(10, 80, 280, 500), new Rect(0, 0, 0, 0));

            return(wnd);
        }
        //This function is used to generate the content in the "Mods" section of the options window
        //The behaviors array contains all behaviours that have been spawned for this mod, one for each implementation
        public void ConstructOptionsScreen(RectTransform parent, ModBehaviour[] behaviours)
        {
            //We need a reference to a behavior to read and write from the mod settings file
            var behavior                  = behaviours.OfType <MultiplayerBehaviour>().First();
            List <GameObject> objs        = new List <GameObject>();
            List <GameObject> windowsObjs = new List <GameObject>();
            var gameWindow                = HUD.Instance;
            TableLayoutWindow ModWindow   = null;
            var screenSizeX               = Screen.width;
            var screenSizeY               = Screen.height;

            //Start by spawning a label
            var label = WindowManager.SpawnLabel();

            label.text = "This Mod was created by LtPain";
            WindowManager.AddElementToElement(label.gameObject, parent.gameObject, new Rect(0, 0, 250, 32),
                                              new Rect(0, 0, 0, 0));

            #region ModControls
            Button mainButton = WindowManager.SpawnButton();
            mainButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "Multiplayer";
            mainButton.onClick.AddListener(() =>
            {
                if (!behavior.loggedin)
                {
                    WindowManager.SpawnInputDialog("Enter IP of the server you want to connect", "Connect", ip, (result) =>
                    {
                        behavior.StartConnect(result);
                    });
                }
                else
                {
                    behavior.CreateMainWindow();
                }
            });
            WindowManager.AddElementToElement(mainButton.gameObject, gameWindow.gameObject, new Rect(screenSizeX - 80f, 0f, 80f, 32f), new Rect(0f, 0f, 0f, 0f));


            int counter = 1;
            foreach (var item in objs)
            {
                WindowManager.AddElementToElement(item, parent.gameObject, new Rect(0, counter * 32, 250, 32),
                                                  new Rect(0, 0, 0, 0));
                counter++;
            }
            #endregion
        }
        /// <summary>
        /// Create the base UI Elements
        /// </summary>
        private void InitializeUI()
        {
            // Make sure the necessary components exist
            if (_mainButton == null)
            {
                _mainButton = WindowManager.SpawnButton();
                _mainButton.GetComponentsInChildren <Text>()[0].text = "Monitor";
                _origColor = _mainButton.GetComponentsInChildren <Text>()[0].color;
                WindowManager.AddElementToElement(_mainButton.gameObject, HUD.Instance.gameObject, new UnityEngine.Rect(0, 20, 100, 20), new UnityEngine.Rect(0, 0, 0, 0));
                _mainButton.onClick.AddListener(OnMainButton_click);
                _lastUpdate = SDateTime.Now();
            }
            if (_wnd == null)
            {
                _wnd             = WindowManager.SpawnWindow();
                _wnd.Title       = "";
                _wnd.StartHidden = true;
                _wnd.OnlyHide    = true;
                //_wnd.TitleText.text = "Server Monitor";
                WindowManager.AddElementToElement(_wnd.gameObject, HUD.Instance.gameObject, new Rect(0, 40, 300, 150), new Rect(0, 0, 0, 0));

                _serverLabel      = WindowManager.SpawnLabel();
                _serverLabel.text = "Total Utilization:";
                WindowManager.AddElementToElement(_serverLabel.gameObject, _wnd.gameObject, new Rect(10, 80, 280, 500), new Rect(0, 0, 0, 0));

                float numPoints = (float)_numberOfHistoricalPoints;
                float pbWidth   = 280f / (numPoints + 1);
                _historicalPoints = new List <DataPoint> [_numberOfHistoricalPoints];
                for (int i = 0; i < _numberOfHistoricalPoints; i++)
                {
                    _historicalPoints[i] = new List <DataPoint>();
                    GUIProgressBar pb = WindowManager.SpawnProgressbar();
                    WindowManager.AddElementToElement(pb.gameObject, _wnd.gameObject, new Rect(10 + (pbWidth * i) + i, 40, 40, pbWidth), new Rect(0, 0, 0, 0));
                    pb.transform.Rotate(0, 0, 90f);
                    pb.transform.Translate(-25f, 0f, 0f);
                    pb.Value = 0;
                    _totalUtilizations.Insert(i, pb);
                }
            }
        }
Example #19
0
 public void Place(GameObject go)
 {
     WindowManager.AddElementToElement(go, Parent, Pos, new Rect(0, 0, 0, 0));
 }
 public void SpawnWindowOnHUD(GUIWindow wnd)
 {
     WindowManager.AddElementToElement(wnd.gameObject, HUD.Instance.gameObject, new Rect(0, 40, 300, 150), new Rect(0, 0, 0, 0));
 }
Example #21
0
        //This function is used to generate the content in the "Mods" section of the options window
        //The behaviors array contains all behaviours that have been spawned for this mod, one for each implementation
        public void ConstructOptionsScreen(RectTransform parent, ModBehaviour[] behaviours)
        {
            //We need a reference to a behavior to read and write from the mod settings file
            var behavior           = behaviours.OfType <TrainerBehaviour>().First();
            List <GameObject> objs = new List <GameObject>();

            //Start by spawning a label
            var label = WindowManager.SpawnLabel();

            label.text = "This Mod was created by LtPain";
            WindowManager.AddElementToElement(label.gameObject, parent.gameObject, new Rect(0, 0, 250, 32),
                                              new Rect(0, 0, 0, 0));



            //Button for some Money
            var buttonMoney = WindowManager.SpawnButton();

            buttonMoney.GetComponentInChildren <UnityEngine.UI.Text> ().text = "Add some Money";
            buttonMoney.onClick.AddListener(() => {
                behavior.IncreaseMoney();
            });
            objs.Add(buttonMoney.gameObject);

            //Button for MaxLand
            var buttonMaxLand = WindowManager.SpawnButton();

            buttonMaxLand.GetComponentInChildren <UnityEngine.UI.Text>().text = "Unlock all space";
            buttonMaxLand.onClick.AddListener(() => {
                behavior.UnlockAllSpace();
            });
            objs.Add(buttonMaxLand.gameObject);

            //Button for AddRep
            var buttonAddRep = WindowManager.SpawnButton();

            buttonAddRep.GetComponentInChildren <UnityEngine.UI.Text>().text = "Add Reputation";
            buttonAddRep.onClick.AddListener(() => {
                behavior.AddRep();
            });
            objs.Add(buttonAddRep.gameObject);

            //Button for UnlockAll
            var buttonUnlockAll = WindowManager.SpawnButton();

            buttonUnlockAll.GetComponentInChildren <UnityEngine.UI.Text>().text = "Unlock all Furniture";
            buttonUnlockAll.onClick.AddListener(() => {
                behavior.UnlockAll();
            });
            objs.Add(buttonUnlockAll.gameObject);

            //Button for EmployeeAge
            var buttonEmployeeAge = WindowManager.SpawnButton();

            buttonEmployeeAge.GetComponentInChildren <UnityEngine.UI.Text>().text = "Reset age of employees";
            buttonEmployeeAge.onClick.AddListener(() => {
                behavior.ResetAgeOfEmployees();
            });
            objs.Add(buttonEmployeeAge.gameObject);

            //Button for MaxSkill
            var buttonMaxSkill = WindowManager.SpawnButton();

            buttonMaxSkill.GetComponentInChildren <UnityEngine.UI.Text>().text = "Max Skill of employees";
            buttonMaxSkill.onClick.AddListener(() => {
                behavior.EmployeesToMax();
            });
            objs.Add(buttonMaxSkill.gameObject);

            //Button for SkipDay
            var buttonSkipDay = WindowManager.SpawnButton();

            buttonSkipDay.GetComponentInChildren <UnityEngine.UI.Text>().text = "Skip Day";
            buttonSkipDay.onClick.AddListener(() => {
                behavior.SkipDay();
            });

            //CheckBox for EmployeeAge
            var lockAge = WindowManager.SpawnCheckbox();

            lockAge.GetComponentInChildren <UnityEngine.UI.Text>().text = "Lock age of employees";
            lockAge.isOn = false;
            lockAge.onValueChanged.AddListener((a) => {
                behavior.LockAgeOfEmployees(a);
            });
            objs.Add(lockAge.gameObject);

            //CheckBox for LockEmployeeStress
            var lockStress = WindowManager.SpawnCheckbox();

            lockStress.GetComponentInChildren <UnityEngine.UI.Text>().text = "Disable Stress";
            lockStress.isOn = false;
            lockStress.onValueChanged.AddListener((a) => {
                behavior.LockStressOfEmployees(a);
            });
            //objs.Add(lockStress.gameObject);

            //Button for UpgradeComputer
            var buttonUpgradeComputer = WindowManager.SpawnButton();

            buttonUpgradeComputer.GetComponentInChildren <UnityEngine.UI.Text>().text = "Upgrade all Computer";
            buttonUpgradeComputer.onClick.AddListener(() => {
                behavior.UpgradeAllComputer();
            });
            objs.Add(buttonUpgradeComputer.gameObject);

            var buttonUpgradeServer = WindowManager.SpawnButton();

            buttonUpgradeServer.GetComponentInChildren <UnityEngine.UI.Text>().text = "Upgrade all Server";
            buttonUpgradeServer.onClick.AddListener(() => {
                behavior.UpgradeAllServer();
            });
            objs.Add(buttonUpgradeServer.gameObject);

            int counter = 1;

            foreach (var item in objs)
            {
                WindowManager.AddElementToElement(item, parent.gameObject, new Rect(0, counter * 32, 250, 32),
                                                  new Rect(0, 0, 0, 0));
                counter++;
            }


            // Button for GenderChange
            // var buttonGenderChange = WindowManager.SpawnButton();
            //buttonGenderChange.GetComponentInChildren<UnityEngine.UI.Text>().text = "Change Employees to Female";
            //buttonGenderChange.onClick.AddListener(() => {
            //    behavior.EmployeesToFemale();
            //});
            //WindowManager.AddElementToElement(buttonGenderChange.gameObject, parent.gameObject, new Rect(0, 128, 250, 32),
            //    new Rect(0, 0, 0, 0));
        }
 public static void AddElement(this GameObject parent, GameObject element, Rect position, Rect anchors)
 {
     WindowManager.AddElementToElement(element, parent, position, anchors);
 }
 public static void AddToElement(this GameObject toAdd, GameObject parent, Rect rect, Rect bounding)
 {
     WindowManager.AddElementToElement(toAdd, parent, rect, bounding);
 }
Example #24
0
		public static void AddElementToElement(GameObject gameObject, string path, Rect location)
		{
			WindowManager.AddElementToElement(gameObject, WindowManager.FindElementPath(path).gameObject, location, new Rect(0, 0, 0, 0));
		}
 public void AddButtonToUI(UnityEngine.UI.Button btn)
 {
     WindowManager.AddElementToElement(btn.gameObject, HUD.Instance.gameObject, new UnityEngine.Rect(0, placementPosition, 100, 20), new UnityEngine.Rect(0, 0, 0, 0));
     placementPosition += int.Parse(btn.gameObject.GetComponent <Renderer>().bounds.size.y.ToString()) + 2;
 }