private void ChangeToPaths(SubMenuStates state_)
    {
        if (currentMenuState != MenuStates.paths)
        {
            currentMenuState = MenuStates.paths;
            currentEC        = sceneElements[2];

            menu.EnableMenu("PathsButton");
            menu.DisableMenu("TopoButton");
            menu.DisableMenu("GraphButton");
            menu.DisableMenu("PeopleButton");
            menu.DisableSimulatorButtons();

            cam.DisableMovement();
        }

        menu.CloseEditMenus();
        currentSubMenuState = state_;
        currentEC.ChangeState(currentSubMenuState);
        GameObject pgo = new GameObject("alg");

        if (state_ == SubMenuStates.edit)
        {
            EnableEditMenu(pgo);
        }
    }
    public void NewScenario(int w_, int h_)
    {
        simulationStarted  = false;
        simulationPaused   = true;
        simulationFinished = false;
        menu.SetPlayText(simulationPaused);


        width = w_; height = h_;
        if (map != null)
        {
            DeleteAll();
        }

        // Create the building/map passing the specified dimensions
        map = GameObject.Instantiate(mapPrefab, this.transform).GetComponent <Map>();
        map.Setup(this, width, height, size);

        graph = GameObject.Instantiate(graphPrefab, this.transform).GetComponent <Graph>();
        graph.Setup(this);

        people = GameObject.Instantiate(peoplePrefab, this.transform).GetComponent <People>();
        people.Setup(this);

        // scene info creation?


        sceneElements = new List <ISceneElement>();
        sceneElements.Add(map);
        sceneElements.Add(graph);
        sceneElements.Add(people);

        currentSceneElement = SceneElementEnum.map;
        currentEC           = sceneElements[(int)currentSceneElement];

        currentMenuState    = MenuStates.cam;
        currentSubMenuState = SubMenuStates.create;

        isoCameraPosition = new Vector3(0, 14, 0);
        isoCameraRotation = Quaternion.Euler(new Vector3(45, 45, 0));

        //DataController.SetProjectName(filename);

        graph.gameObject.SetActive(true);
    }
        /// <summary>
        /// Handles state updates within the editor extension.
        /// </summary>
        /// <param name="state">the state that triggered this event.</param>
        /// <param name="status">a generic message about the status.</param>
        /// <param name="json">a generic container for additional JSON encoded info.</param>
        public static void StateUpdateHandler(PlayFabEditor.EdExStates state, string status, string json)
        {
            switch (state)
            {
            case PlayFabEditor.EdExStates.OnMenuItemClicked:
                if (status == "Settings")
                {
                    _subMenuState  = SubMenuStates.StandardSettings;
                    _isSettingsSet = false;
                    studioOptions  = null;
                    SetSettingsProperties();
                }
                break;

            case PlayFabEditor.EdExStates.OnLogin:
                studioOptions = null;
                break;
            }
        }
    private void ChangeToGraph(SubMenuStates state_)
    {
        if (currentMenuState != MenuStates.graph)
        {
            currentMenuState = MenuStates.graph;
            currentEC        = sceneElements[1];

            menu.EnableMenu("GraphButton");
            menu.DisableMenu("TopoButton");
            menu.DisableMenu("PeopleButton");
            menu.DisableMenu("PathsButton");
            menu.DisableSimulatorButtons();

            cam.DisableMovement();
        }
        graph.gameObject.SetActive(true);
        menu.CloseEditMenus();
        currentSubMenuState = state_;
        currentEC.ChangeState(currentSubMenuState);
    }
    private void ChangeToTopology(SubMenuStates state_)
    {
        if (currentMenuState != MenuStates.map)
        {
            currentMenuState = MenuStates.map;
            currentEC        = sceneElements[0];

            menu.EnableMenu("TopoButton");
            menu.DisableMenu("GraphButton");
            menu.DisableMenu("PeopleButton");
            menu.DisableMenu("PathsButton");
            menu.DisableSimulatorButtons();

            cam.DisableMovement();
        }

        menu.CloseEditMenus();
        currentSubMenuState = state_;
        currentEC.ChangeState(currentSubMenuState);
    }
    private void ChangeToPeople(SubMenuStates state_)
    {
        if (currentMenuState != MenuStates.people)
        {
            currentMenuState = MenuStates.people;
            currentEC        = sceneElements[2];

            menu.EnableMenu("PeopleButton");
            menu.DisableMenu("TopoButton");
            menu.DisableMenu("GraphButton");
            menu.DisableMenu("PathsButton");
            menu.DisableSimulatorButtons();

            cam.DisableMovement();
        }

        menu.CloseEditMenus();
        currentSubMenuState = state_;
        currentEC.ChangeState(currentSubMenuState);
        if (state_ == SubMenuStates.create)
        {
            EnableEditMenu(people.GetNextPerson().gameObject);
        }
    }
Ejemplo n.º 7
0
 public void ChangeState(SubMenuStates state_)
 {
     state = state_;
 }
Ejemplo n.º 8
0
        // Depending on where we are, we hop back to the previous option
        private void ReturnToPreviousOption()
        {
            if (prevIndexMenus.Count > 0)
            {
                ChangeSelectedText(currentMenuIndex, -1);

                if (currentSubMenuState == SubMenuStates.HIDDEN)
                {
                    // If we are at the root of a menu, we return to the main menu
                    switch (currentState)
                    {
                    case MenuStates.ITEM:
                        itemMenuObject.SetActive(false);
                        break;

                    case MenuStates.PARTY:
                        partyMenuObject.SetActive(false);
                        break;

                    case MenuStates.GEAR:
                        gearMenuObject.SetActive(false);
                        break;

                    case MenuStates.LINK:
                        linkMenuObject.SetActive(false);
                        break;
                    }

                    currentMenuParent = pauseMenuObject.transform.GetChild(0);
                    currentMenuParent.gameObject.SetActive(true);
                    currentState = MenuStates.MAIN;
                }
                else
                {
                    // If we are in a root of a menu, depending on our sub state, we act accordingly
                    // In this case, we are presuming that when we are in a substate, we exit back to the hidden sub menu state
                    switch (currentState)
                    {
                    case MenuStates.ITEM:
                        itemMenuObject.transform.GetChild(1).gameObject.SetActive(false);
                        itemMenuObject.transform.GetChild(3).gameObject.SetActive(false);
                        currentMenuParent = itemMenuObject.transform.GetChild(0).GetChild(0).GetChild(0);
                        UpdateItemMenu();
                        break;

                    case MenuStates.PARTY:
                        break;

                    case MenuStates.GEAR:
                        break;

                    case MenuStates.LINK:
                        break;
                    }
                    currentSubMenuState = SubMenuStates.HIDDEN;
                }

                // We check to see if the new option is a valid point.
                int newIndex = prevIndexMenus.Pop();
                while (CheckIfOptionIsValid(newIndex) == false && newIndex > 0)
                {
                    // If we ran into an invalid point, we subtract from the index until we hit one
                    // OR if newIndex reaches 0, we automatically exit the loop and use that value
                    newIndex--;
                }
                ChangeSelectedText(currentMenuIndex, newIndex);
                currentMenuIndex = newIndex;
            }
            else
            {
                // We must be at the main menu, so we simply close the menu
                StartCoroutine(HideMenu());
            }
        }
Ejemplo n.º 9
0
        // The actions that are taken when we are in the item context
        private void ItemMenuActions()
        {
            if (currentState == MenuStates.ITEM)
            {
                // We selected an item
                if (currentSubMenuState == SubMenuStates.HIDDEN)
                {
                    // We first activate our menus, setting them to how they should look
                    itemMenuObject.transform.GetChild(1).gameObject.SetActive(true);
                    itemMenuObject.transform.GetChild(3).gameObject.SetActive(true);
                    ChangeSelectedText(currentMenuIndex, -1);
                    prevIndexMenus.Push(currentMenuIndex);

                    // We then set up the logic for the sub menu that follows
                    currentSubMenuState = SubMenuStates.SUB1;
                    currentMenuIndex    = 0;
                    currentMenuParent   = itemMenuObject.transform.GetChild(1).GetChild(0).GetChild(0);
                    InitializeSubPartyMenu();
                    UpdateMenuContext();
                    ChangeSelectedText(currentMenuIndex, 0);
                }
                // We selected our target to use the item on
                else if (currentSubMenuState == SubMenuStates.SUB1)
                {
                    // We peek into our stack to get the item we selected
                    InventoryItem currItem = playerInventory.GetItemAtIndex(prevIndexMenus.Peek());
                    if (currItem.SpecifiedItem.itemType == ItemType.HEALTH)
                    {
                        if (playerInventory.GetInventoryCharacterAtIndex(currentMenuIndex).CurrentHealthPoints < playerInventory.GetInventoryCharacterAtIndex(currentMenuIndex).ReturnModdedStat("MaxHP"))
                        {
                            // We healed the player by the item amount
                            playerInventory.GetInventoryCharacterAtIndex(currentMenuIndex).CurrentHealthPoints += currItem.SpecifiedItem.itemAmount;
                            playerInventory.RemoveItemFromInventory(currItem, 1);
                            UpdateMenuContext();
                            Debug.Log("Used " + currItem.SpecifiedItem.itemName);
                        }
                        else
                        {
                            itemMenuObject.transform.GetChild(2).GetComponentInChildren <TextMeshProUGUI>().text = "This character's HP is already full!";
                        }
                    }
                    else if (currItem.SpecifiedItem.itemType == ItemType.SP)
                    {
                        if (playerInventory.GetInventoryCharacterAtIndex(currentMenuIndex).CurrentHealthPoints < playerInventory.GetInventoryCharacterAtIndex(currentMenuIndex).ReturnModdedStat("MaxSP"))
                        {
                            // We healthed the player by the item amount
                            playerInventory.GetInventoryCharacterAtIndex(currentMenuIndex).CurrentSkillPoints += currItem.SpecifiedItem.itemAmount;
                            playerInventory.RemoveItemFromInventory(currItem, 1);
                            UpdateMenuContext();
                            Debug.Log("Used " + currItem.SpecifiedItem.itemName);
                        }
                        else
                        {
                            itemMenuObject.transform.GetChild(2).GetComponentInChildren <TextMeshProUGUI>().text = "This character's SP is already full!";
                        }
                    }

                    // If we run out of this current item, we automatically return to the initial menu of selectng an item
                    if (currItem.Quantity <= 0)
                    {
                        ReturnToPreviousOption();
                        UpdateMenuContext();
                    }
                }
            }
        }
 private static void OnTitleSettingsClicked()
 {
     _subMenuState = SubMenuStates.TitleSettings;
 }
 private static void OnStandardSetttingsClicked()
 {
     _subMenuState = SubMenuStates.StandardSettings;
 }
 private static void OnApiSettingsClicked()
 {
     _subMenuState = SubMenuStates.ApiSettings;
 }