void Start() { m_roomButtons = new Button[m_company.GetRooms().Length]; for (int i = 0; i < m_roomButtons.Length; ++i) { Button button = Instantiate(buttonPrefab); m_roomButtons[i] = button; button.GetComponentInChildren <Text>().text = "Room " + i + "\nEmpty"; button.transform.SetParent(roomListScrollRect.content); button.transform.SetAsLastSibling(); int roomIndex = i; button.onClick.AddListener(() => { OpenRoomWindow(roomIndex); }); } startMissionButton.onClick.AddListener(() => { UIWindow window; if (UIWindowManager.Instance().CreateWindow("Start Mission", out window)) { RectTransform missionPreprationContent = Instantiate(missonPreparationWindowContentPrefab); window.SetContent(missionPreprationContent); missionPreprationContent.GetComponent <MissionPreparation>().SetMission(new Mission()); } }); }
private void Awake() { _instance = this; uiControllerList = new List <AbsUIControllerBase>(); uiWindowList = new List <UIWindowMonoBase>(); UIWindowManager.Init(uiWindowData); }
void OnStaffHired(Staff _staff) { Button button = Instantiate(listButtonPrefab); Text buttonText = button.GetComponentInChildren <Text>(); buttonText.text = _staff.GetName(); button.onClick.AddListener(() => { UIWindow window = null; if (UIWindowManager.Instance().CreateWindow(_staff.GetName(), out window)) { RectTransform content = Instantiate(emptyWindowContentPrefab); window.SetContent(content); Button fireButton = Instantiate(buttonPrefab); fireButton.GetComponentInChildren <Text>().text = "Fire"; fireButton.onClick.AddListener(() => { m_company.FireStaff(_staff); }); fireButton.transform.SetParent(content); } }); (button.transform as RectTransform).SetParent(staffListScrollRect.content); m_staffButtons.Add(_staff.GetID(), button); }
public UIWindowManager OpenWindow(UIWindowManager parent) { this.parent = parent; gameObject.SetActive(true); StartCoroutine(AnimateWindow(1)); return this; }
public virtual void Update(GameTime gameTime) { // Update 3D graph SceneGraph.Update(gameTime); // Update 2D UI UIWindowManager.Update(gameTime); }
void ResetMissionDesc() { UnityTools.DestroyAllChildren(assignableList.content); UnityTools.DestroyAllChildren(assignedList.content); assignableText.text = "Assignable monsters (" + m_assignedMonsters.Count + ")"; foreach (Monster monster in m_assignableMonsters) { Button button = Instantiate(m_UI.listButtonPrefab); button.GetComponentInChildren <Text>().text = monster.GetName() + " (" + monster.GetCurrentStrength() + "/" + monster.GetMaxStrength() + ")"; button.transform.SetParent(assignableList.content); button.interactable = m_assignedMonsters.Count < m_mission.maxMonstersCount; Monster m = monster; button.onClick.AddListener(() => { m_assignableMonsters.Remove(m); m_assignedMonsters.Add(m); ResetMissionDesc(); }); if (monster.GetCurrentStrength() != monster.GetMaxStrength()) { // TODO plug an event on heal button.interactable = false; } } assignedText.text = "Assigned monsters (" + m_assignedMonsters.Count + "/" + m_mission.maxMonstersCount + ")"; foreach (Monster monster in m_assignedMonsters) { Button button = Instantiate(m_UI.listButtonPrefab); button.GetComponentInChildren <Text>().text = monster.GetName() + " (" + monster.GetCurrentStrength() + "/" + monster.GetMaxStrength() + ")"; button.transform.SetParent(assignedList.content); Monster m = monster; button.onClick.AddListener(() => { m_assignedMonsters.Remove(m); m_assignableMonsters.Add(m); ResetMissionDesc(); }); } startMissionButton.interactable = m_assignedMonsters.Count != 0; startMissionButton.onClick.RemoveAllListeners(); startMissionButton.onClick.AddListener(() => { m_company.StartMission(m_mission, m_assignedMonsters); UIWindowManager.Instance().DestroyWindow(transform.GetComponentInParent <UIWindow>()); }); missionText.text = ""; missionText.text += "Obstacles count: " + m_mission.obstacles.Length + "\n"; missionText.text += "Maximum monsters: " + m_mission.maxMonstersCount + "\n"; missionText.text += "Reward: " + m_mission.reward + "$\n"; }
private void RenderUI() { // Render 2D Performance.Push("BaseScene.Draw (Render2D)"); // Clear depth buffer and stencil again for 2D rendering Clear(Color.Lavender, ClearOptions.DepthBuffer | ClearOptions.Stencil, 1, 0); UIWindowManager.Draw(); MouseCursor?.Render(); Performance.Pop(); }
public virtual void Close() { RenderManager.Stop(); UIWindowManager.Clear(); ContentManager.Unload(); ContentManager.Dispose(); ContentManager = null; }
public static UIWindowManager Instance() { UIWindowManager instance = FindObjectOfType <UIWindowManager>(); if (instance == null) { Debug.LogError("You need to have one instance of UIWindowManager in the scene."); } return(instance); }
public static void Create(MainUIManager uiManager, Action <UITipsWindow> act) { if (!isInit) { isInit = true; UIWindowManager.windowDictionary.Add(typeof(UITipsWindow), UIWindowManager.uiWindowData.tipsWindowAsset); } UIWindowManager.CreateWindow(uiManager, act); }
public UIWindowManager() { if (Singleton == null) { Singleton = this; OnCreate(); } else { throw new System.Exception(); //if singleton exist, throw a Exception } }
void OnStaffFired(Staff _staff) { Button button = null; if (m_staffButtons.TryGetValue(_staff.GetID(), out button)) { UIWindowManager.Instance().DestroyWindow(_staff.GetName()); Destroy(button.gameObject); m_staffButtons.Remove(_staff.GetID()); } }
public virtual void PointerWheelChanged(Vector2 deltaValue, GameTime gameTime) { bool res = UIWindowManager.PointerWheelChanged(deltaValue, gameTime); if (res == false) { // Event was not handled by UI res = CurrentController?.PointerWheelChanged(deltaValue) ?? false; if (res == false) { CurrentCamera?.PointerWheelChanged(deltaValue); } } }
public virtual bool KeyReleased(Keys key, GameTime gameTime) { bool res = UIWindowManager.KeyReleased(key, gameTime); if (res == false) { // Event was not handled by UI res = CurrentController?.KeyReleased(key) ?? false; if (res == false) { CurrentCamera?.KeyReleased(key); } } return(res); }
void Awake() { UIWindow self = this; m_windowRectTransform = transform as RectTransform; closeButton.onClick.AddListener(() => { if (OnWindowClosed != null) { OnWindowClosed(self); } UIWindowManager.Instance().DestroyWindow(self); }); }
void OnMissionStarted(MissionInstance _mission) { UIWindow window; if (UIWindowManager.Instance().CreateWindow("Mission Progress", out window)) { RectTransform content = Instantiate(UIManager.Instance().missionProgressWindowContentPrefab); window.SetContent(content); MissionProgress missionProgress = content.GetComponent <MissionProgress>(); window.OnWindowClosed += (UIWindow w) => { m_company.EndCurrentMission(); }; missionProgress.SetMissionInstance(_mission); } }
public void OpenRoomWindow(int _index) { Room room = m_company.GetRooms()[_index]; if (room != null) { UIWindow window = null; if (UIWindowManager.Instance().CreateWindow(room.GetName(), out window)) { room.FillWindowContent(window); } } else { UIWindow window = null; if (UIWindowManager.Instance().CreateWindow("Room " + _index, out window)) { GameObject content = new GameObject(); content.name = "Empty Room Window Content"; content.AddComponent <VerticalLayoutGroup>(); for (int j = 0; j < Enum.GetNames(typeof(RoomType)).Length; ++j) { RoomType roomType = (RoomType)j; Button roomButton = Instantiate(listButtonPrefab); roomButton.GetComponentInChildren <Text>().text = "Build " + roomType.ToString(); roomButton.transform.SetParent(content.transform); roomButton.onClick.AddListener(() => { m_company.BuildRoom(roomType, _index); UIWindowManager.Instance().DestroyWindow(window); OpenRoomWindow(_index); }); } window.SetContent(content.transform as RectTransform); } } }
public virtual void PointerUp(Vector2 position, PointerType pointerType, GameTime gameTime) { bool res = UIWindowManager.PointerUp(position, pointerType, gameTime); if (res == false) { // Event was not handled by UI if (MouseCursor != null) { MouseCursor.IsVisible = mouseCursorWasVisible; } isMouseCaptured = false; res = CurrentController?.PointerUp(position, pointerType) ?? false; if (res == false) { CurrentCamera?.PointerUp(position, pointerType); } } }
public virtual void PointerMoved(Vector2 position, GameTime gameTime) { bool res = UIWindowManager.PointerMoved(position, gameTime); if (res == false) { // Event was not handled by UI if (isMouseCaptured) { res = CurrentController?.PointerMoved(position) ?? false; if (res == false) { CurrentCamera?.PointerMoved(position); } Mouse.SetPosition((int)lastMousePos.X, (int)lastMousePos.Y); } } }
private void OnTrainButtonClickedNew(UISkillTrainingUpgrade upgradeView) { Game.CharacterStats.SkillType skillType = upgradeView.SkillType; float skillPerRankMultiplier = StatsData.Instance.GetSkillPerRankMultiplier(skillType); int skillRank = this.m_selectedCharacter.GetSkillRank(skillType); int num = skillRank + 1; if (num > this.m_trainer.maxSkillLevel) { UIMessageBox uIMessageBox = UIWindowManager.ShowMessageBox(UIMessageBox.UIDialogButtons.OK, SDK.GUIUtils.GetText(2131), string.Format(SDK.GUIUtils.GetText(2129), this.m_trainer.maxSkillLevel)); uIMessageBox.ShowWindow(); return; } if (this.m_selectedCharacter.SkillsTrainedThisLevel >= this.m_selectedCharacter.Level * 5) { UIMessageBox uIMessageBox2 = UIWindowManager.ShowMessageBox(UIMessageBox.UIDialogButtons.OK, SDK.GUIUtils.GetText(2131), SDK.GUIUtils.GetText(2132)); uIMessageBox2.ShowWindow(); return; } int num2 = Game.CharacterStats.CopperCostToTrainSkillToNextRank(num); Game.PlayerInventory component = Game.GameState.s_playerCharacter.GetComponent <Game.PlayerInventory>(); if (component == null || component.currencyTotalValue < (float)num2) { UIMessageBox uIMessageBox3 = UIWindowManager.ShowMessageBox(UIMessageBox.UIDialogButtons.OK, SDK.GUIUtils.GetText(2131), SDK.GUIUtils.GetText(2128)); uIMessageBox3.ShowWindow(); return; } if (Game.TelemetryManager.Instance && Game.Stronghold.Instance) { Game.TelemetryManager.Instance.QueueEvent_SkyPillarUpgradeUsed(SDK.TelemetryManager.Destination.Developer | SDK.TelemetryManager.Destination.Publisher, Game.Stronghold.Instance.GetUpgradeLocation(StrongholdUpgrade.Type.Weapons_Training), StrongholdUpgrade.Type.Weapons_Training, string.Empty, skillType); } GlobalAudioPlayer.SPlay(UIAudioList.UIAudioType.TrainSkill); int xp = Game.CharacterStats.ExperienceNeededForNextSkillRank(skillRank, skillPerRankMultiplier) - this.m_selectedCharacter.SkillXP[(int)skillType]; component.RemoveCurrency((float)num2, 1); this.m_selectedCharacter.SkillsTrainedThisLevel++; this.m_selectedCharacter.CalculateAndApplySkillXP(upgradeView.SkillType, xp, null, 0, 0); this.Reload(); }
private void OnClickNew() { if (m_currentPartyMember != null) { if (isRoster) { if (m_currentPartyMember.MemberStatus == PartyMemberStatus.InactiveOnAdventure) { UIWindowManager.ShowMessageBox(UIMessageBox.ButtonStyle.Ok, GuiStringTable.GetText(873), GuiStringTable.Format(896, m_currentPartyMember.Name, string.Empty)); } else if (UISingletonHudWindow <UIPartyManager> .Instance.Party.ActiveChildCount < 6) { UISingletonHudWindow <UIPartyManager> .Instance.PartyCharacter(m_currentPartyMember); } } else if (!m_currentPartyMember.IsPlayer) { UISingletonHudWindow <UIPartyManager> .Instance.BenchCharacter(m_currentPartyMember); } UISingletonHudWindow <UIPartyManager> .Instance.Reload(); } }
void OnMonsterHired(Monster _monster) { Button button = Instantiate(listButtonPrefab); Text buttonText = button.GetComponentInChildren <Text>(); buttonText.text = _monster.GetName(); button.onClick.AddListener(() => { UIWindow window = null; if (UIWindowManager.Instance().CreateWindow(_monster.GetName(), out window)) { RectTransform content = Instantiate(emptyWindowContentPrefab); window.SetContent(content); Text text = Instantiate(windowTextPrefab); text.text = "Strength : " + _monster.GetCurrentStrength() + "/" + _monster.GetMaxStrength(); text.transform.SetParent(content); } }); (button.transform as RectTransform).SetParent(monstersListScrollRect.content); m_monstersButtons.Add(_monster.GetID(), button); }
internal override void PointerDown(Microsoft.Xna.Framework.Vector2 position, PointerType pointerType) { UIWindowManager.PointerDown(position, pointerType); }
internal override void Draw(GameTime gameTime) { UIWindowManager.Render(); FontRenderer.DrawStringDirect(MainGame.DefaultFont, "Version: " + MainGame.Version, 270, 194, Color.White, 0.5f); }
internal override void PointerMoved(Vector2 position) { UIWindowManager.PointerMoved(position); }
internal override void Draw(Microsoft.Xna.Framework.GameTime gameTime) { UIWindowManager.Render(); }
internal override void PointerMoved(Microsoft.Xna.Framework.Vector2 position) { UIWindowManager.PointerMoved(position); }
void Awake() { windowManager = UIWindowManager.Instance; }
void OnDestroy() { windowManager = null; }
public void mod_FinalizeLevelLoad() { try { if (this.CurrentMap != null && !this.CurrentMap.HasBeenVisited && BonusXpManager.Instance && this.CurrentMap.GivesExplorationXp) { this.CurrentMap.HasBeenVisited = true; int mapExplorationXp = 0; if (BonusXpManager.Instance != null) { mapExplorationXp = BonusXpManager.Instance.MapExplorationXp; } Console.AddMessage(string.Concat("[", NGUITools.EncodeColor(Color.yellow), "]", Console.Format(GUIUtils.GetTextWithLinks(1633), new object[] { this.CurrentMap.DisplayName, mapExplorationXp * PartyHelper.NumPartyMembers }))); PartyHelper.AssignXPToParty(mapExplorationXp, false); } if (GameState.OnLevelLoaded != null) { GameState.OnLevelLoaded(Application.loadedLevelName, EventArgs.Empty); } if (GameState.NewGame && this.Difficulty == GameDifficulty.Easy) { GameState.Option.AutoPause.SetSlowEvent(AutoPauseOptions.PauseEvent.CombatStart, true); } ScriptEvent.BroadcastEvent(ScriptEvent.ScriptEvents.OnLevelLoaded); GameState.IsLoading = false; if (GameState.s_playerCharacter != null && !GameState.LoadedGame && !GameState.NewGame && GameState.NumSceneLoads > 0) { if (!IEModOptions.SaveBeforeTransition) // added this line { if (FogOfWar.Instance) { FogOfWar.Instance.WaitForFogUpdate(); } AutosaveIfAllowed(); } } GameState.NewGame = false; if (this.CurrentMap != null && this.CouldAccessStashOnLastMap != this.CurrentMap.GetCanAccessStash() && !GameState.Option.GetOption(GameOption.BoolOption.DONT_RESTRICT_STASH)) { if (!this.CurrentMap.GetCanAccessStash()) { UISystemMessager.Instance.PostMessage(GUIUtils.GetText(1566), Color.white); } else { UISystemMessager.Instance.PostMessage(GUIUtils.GetText(1565), Color.white); } } GameState.NumSceneLoads = GameState.NumSceneLoads + 1; FatigueCamera.CreateCamera(); GammaCamera.CreateCamera(); WinCursor.Clip(true); if (this.CurrentMap != null) { TutorialManager.TutorialTrigger tutorialTrigger = new TutorialManager.TutorialTrigger(TutorialManager.TriggerType.ENTERED_MAP) { Map = this.CurrentMap.SceneName }; TutorialManager.STriggerTutorialsOfType(tutorialTrigger); } if (this.CurrentMap != null && this.CurrentMap.IsValidOnMap("px1")) { GameState.Instance.HasEnteredPX1 = true; if (GameGlobalVariables.HasStartedPX2()) { this.HasEnteredPX2 = true; } } // in here you can place something like if (CurrentMap.SceneName == "AR_0011_Dyrford_Tavern_02") make_an_NPC; or change_NPC's_stats; // added this code // Addition of autoload custom NPC stats if enabled if (IEModOptions.AutoLoadCustomStats) { ImportStats(); } DropButton.InjectDropInvButton(); if (IEModOptions.EnableCustomUi) { if (IEModOptions.Layout == null) { UICustomizer.Initialize(); IEModOptions.Layout = UICustomizer.DefaultLayout.Clone(); } else { UICustomizer.LoadLayout(IEModOptions.Layout); } } BackerNamesMod.FixBackerNames(IEModOptions.FixBackerNames); } catch (Exception exception) { Debug.LogException(exception); GameState.ReturnToMainMenuFromError(); } if (!this.RetroactiveSpellMasteryChecked) { for (int i = 0; i < (int)PartyMemberAI.PartyMembers.Length; i++) { if (PartyMemberAI.PartyMembers[i] != null) { CharacterStats component = PartyMemberAI.PartyMembers[i].GetComponent <CharacterStats>(); if (component) { if (component.MaxMasteredAbilitiesAllowed() > component.GetNumMasteredAbilities()) { UIWindowManager.ShowMessageBox(UIMessageBox.ButtonStyle.OK, GUIUtils.GetText(2252), GUIUtils.GetText(2303)); break; } } } } this.RetroactiveSpellMasteryChecked = true; } if (GameUtilities.HasPX2() && GameState.LoadedGame) { if (GameGlobalVariables.HasFinishedPX1()) { QuestManager.Instance.StartPX2Umbrella(); } else if (!this.HasNotifiedPX2Installation) { UIWindowManager.ShowMessageBox(UIMessageBox.ButtonStyle.OK, string.Empty, GUIUtils.GetText(2438)); this.HasNotifiedPX2Installation = true; } } }
private void Awake() { Instance = this; }
internal override void Close() { UIWindowManager.Clear(); }