예제 #1
0
    public void BuyWpnButtonInteraction(bool wpn2)
    {
        SovereignWpn buyable;

        if (wpn2)
        {
            buyable = GameDataManager.Instance.dataStore.buyable1;
        }
        else
        {
            buyable = GameDataManager.Instance.dataStore.buyable0;
        }
        if (buyable.wpnLevel > 1)
        {
            if (GameDataManager.Instance.SpendManaIfPossible(lv2cost))
            {
                GameDataManager.Instance.GiveSovereignBuyableWpn(wpn2);
                shell.Close();
            }
            else
            {
                shell.SurrenderFocus();
                insufficientResourcesPopup.Open();
            }
        }
        else
        {
            int[] costs;
            if (buyable.wpnLevel == 0)
            {
                costs = new int[] { lv0cost, lv0cost, lv0cost }
            }
            ;
            else
            {
                costs = new int[] { lv1cost, lv1cost, lv1cost }
            };
            if (GameDataManager.Instance.SpendResourcesIfPossible(costs))
            {
                GameDataManager.Instance.GiveSovereignBuyableWpn(wpn2);
                shell.Close();
            }
            else
            {
                shell.SurrenderFocus();
                insufficientResourcesPopup.Open();
            }
        }
    }
예제 #2
0
        private void OnOptions()
        {
            StateLayer val = default(StateLayer);

            if (StateManager.TryGetLayer("OptionUI", ref val))
            {
                StateManager.SetActiveInputLayer(val);
                UIManager.instance.NotifyLayerIndexChange();
                OptionState optionState = new OptionState
                {
                    onStateClosed = OnOptionsClosed
                };
                val.GetChainEnd().SetChildState(optionState, 0);
            }
            m_popupMenu.Close();
        }
예제 #3
0
 public void Close()
 {
     if (HasFlag(MessageFlags.LaunchAdventureOnClose))
     {
         advScreenChanger.Activate();
     }
     shell.Close();
 }
예제 #4
0
 public void SpClose()
 {
     if (lState == PeddlerLocalState.PeddlerPaid)
     {
         ChangeLocalState(PeddlerLocalState.PeddlerDone);
     }
     shell.Close();
 }
예제 #5
0
 public void ConfirmedRetrain()
 {
     if (cachedClass == AdventurerClass.Warrior)
     {
         associatedAdventurer.Reclass(AdventurerClass.Mystic);
     }
     else
     {
         associatedAdventurer.Reclass(AdventurerClass.Warrior);
     }
     shell.Close();
 }
예제 #6
0
 public void Depart()
 {
     int[] costs = { 0, 0, 0, GameDataManager.Instance.dataStore.nextRandomAdventureAnte, GameDataManager.Instance.dataStore.nextRandomAdventureAnte, GameDataManager.Instance.dataStore.nextRandomAdventureAnte };
     if (GameDataManager.Instance.dataStore.adventureLevel >= AdventureSubstageLoader.randomAdventureBaseLevel)
     {
         if (GameDataManager.Instance.SpendResourcesIfPossible(costs))
         {
             shell.Close();
             screenChanger.Activate();
         }
         else
         {
             insufficientResourcesPopup.Open();
         }
     }
     else
     {
         shell.Close();
         screenChanger.Activate();
     }
 }
예제 #7
0
    public void PromoteUnit()
    {
        int manaCost = Adventurer.GetPromoteCostForClass(setClass);

        if (GameDataManager.Instance.SpendManaIfPossible(manaCost))
        {
            adv.PromoteToTier2(setClass);
            shell.Close();
        }
        else
        {
            shell.SurrenderFocus();
            insufficientResourcesPopup.Open();
        }
    }
예제 #8
0
 public void CalledShotsButtonInteraction()
 {
     if (GameDataManager.Instance.dataStore.unlock_sovSpe_CalledShots)
     {
         GameDataManager.Instance.SetSovereignSpecial(AdventurerSpecial.CalledShots);
         shell.Close();
     }
     else if (GameDataManager.Instance.SpendResourcesIfPossible(5, 5, 5))
     {
         GameDataManager.Instance.dataStore.unlock_sovSpe_CalledShots = true;
         GameDataManager.Instance.SetSovereignSpecial(AdventurerSpecial.CalledShots);
         shell.Close();
     }
     else
     {
         shell.SurrenderFocus();
         insufficientResourcesPopup.Open();
     }
 }
예제 #9
0
 public void FlankingButtonInteraction()
 {
     GameDataManager.Instance.SetSovereignTactic(BattlerAction.Flanking);
     shell.Close();
 }
예제 #10
0
    // Draw
    public override void Draw()
    {
        // Top layer
        GUI.depth = 0;

        // Set GUI font
        if (GUI.skin.font != Config.instance.font)
        {
            GUI.skin.font = Config.instance.font;
        }

        GUIArea.width  = Screen.width;
        GUIArea.height = Screen.height;

        if (introEnabled)
        {
            return;
        }

        // Always draw the invisible focus control
        GUIHelper.UnityFocusFix();

        // Clear focus
        ClearFocus();

        // Exit button and version number
        DrawExitButtonAndVersion();

        // Clearing popup menu
        bool popupClear = false;

        if (
            popupMenu != null &&
            (
                (Event.current.isMouse && Event.current.type == EventType.MouseUp && Event.current.button == 0) ||
                (Event.current.isKey && Event.current.keyCode == KeyCode.Escape)
            )
            )
        {
            popupClear = true;
        }

        // General keys
        UpdateGeneralKeys();

        // State
        switch (GameManager.currentState)
        {
        case State.ConnectingToLobby:   ConnectingToLobbyGUI(); break;

        case State.Disconnected:                DisconnectedGUI();              break;

        case State.Update:                              PleaseUpdateGUI();              break;

        case State.LogIn:                               LoginGUI();                     break;

        case State.Register:                    RegisterGUI();                  break;

        case State.License:                             LicenseGUI();                   break;

        case State.Lobby:                               LobbyGUI();                     break;

        case State.Game:
            /*if(Event.current.isKey && Event.current.keyCode == KeyCode.Tab || Event.current.character == '\t' && !gameLobby.lobbyChat.chatInputFocused) {
             *      if(GameManager.serverType != ServerType.Town || Player.main == null || !Player.main.talkingWithNPC) {
             *              GUIHelper.Focus(GUI.GetNameOfFocusedControl());
             *              Event.current.Use();
             *      }
             * }*/

            if (MainMenu.instance != null && (MainMenu.instance.currentState == InGameMenuState.Lobby))
            {
                using (new GUIArea(Screen.width * 0.95f, Screen.height * 0.95f)) {
                    LobbyGUI();
                }
            }

            // On 1366 x 768 laptop screen you should use
            // 0.85f width for profile at least, 0.91f for artifacts
            // 0.75f height max
            if (Player.main != null && Player.main.talkingWithNPC)
            {
                using (new GUIArea(Screen.width * 0.91f, Screen.height * 0.75f)) {
                    Player.main.talkingWithNPC.Draw();
                }
            }
            break;
        }

        // Changelog
        DrawChangeLog();

        // Popup menu
        if (popupMenu != null)
        {
            popupMenu.Draw();

            if (popupClear && popupMenu != null)
            {
                popupMenu.Close();
            }
        }

        // Tooltip
        DrawTooltip();

        // Popup window
        if (popupWindow != null)
        {
            // Dim background
            DimBackground();

            using (new GUIArea(new Rect(GUIArea.width * 0.25f, GUIArea.height * 0.25f, GUIArea.width * 0.5f, GUIArea.height * 0.5f))) {
                using (new GUIVerticalCenter()) {
                    using (new GUIHorizontalCenter()) {
                        popupWindow.DrawAll();
                    }
                }
            }
        }

        // Disable game input when GUI is active
        if (GUIUtility.hotControl != 0 || GUIUtility.keyboardControl != 0)
        {
            InputManager.ignoreInput = true;
            InputManager.instance.Clear();
        }
        else
        {
            InputManager.ignoreInput = false;
        }

        // Debug
        if (Debugger.instance.debugGUI && Event.current.type == EventType.Layout)
        {
            Debugger.Label("FocusedControl: " + GUI.GetNameOfFocusedControl());
            Debugger.Label("HotControl: " + GUIUtility.hotControl.ToString());
            Debugger.Label("KeyboardControl: " + GUIUtility.keyboardControl.ToString());
        }

        // Debugger
        Debugger.instance.Draw();
    }
예제 #11
0
 public void ReturnFromBattle()
 {
     shell.Close();
     screenChanger.Activate();
 }
예제 #12
0
 public void Win()
 {
     cutscenePlayer.StartCutscene(overworldCutscenePlayerEndingIndex);
     shell.Close();
 }
예제 #13
0
 public void SetMace()
 {
     GameDataManager.Instance.ChangeSetSovWpn(WpnType.Mace);
     shell.Close();
 }
예제 #14
0
 public void OpenDocksPopup()
 {
     shell.Close();
     docksPopup.Open();
 }
예제 #15
0
 public void RerollAsHuman()  // yes there have to be three of these - ugly af but Unity can't invoke functions with args from UI buttons
 {
     associatedAdventurer.Reroll(associatedAdventurer.advClass, AdventurerSpecies.Human, associatedAdventurer.isElite, Adventurer.GetRandomStatPoint());
     shell.Close();
 }