예제 #1
0
        public void processInput(string s)
        {
            if (s.Contains("iNumSelectable"))
            {
                Debug.Log("Recieved ListPrompt command!");

                ListPrompt p = JsonUtility.FromJson <ListPrompt>(s);
                promptWindowManager.PromptPopup(p);
            }
            else if (s.Contains("sPromptTitle"))
            {
                OpenPrompt p = JsonUtility.FromJson <OpenPrompt>(s);
                promptWindowManager.OpenPromptPopup(p);
            }
            if (s.Contains("currentTempDungeon"))
            {
                GetComponent <GameManager>().activeCampaign = JsonUtility.FromJson <Campaign>(s);
                Debug.Log("Making campaign from JSON");
                if (GetComponent <GameManager>().activeCampaign.currentTempDungeon == null)
                {
                    Debug.Log("Current tempDungeon is null, you have entirely failed.");
                }
                if (GetComponent <GameManager>().activeCampaign.currentTempDungeon != null)
                {
                    Debug.Log("Current tempDungeon is not null");
                }
                GetComponent <GameManager>().activeCampaign.toNormalDungeons();
                if (GetComponent <GameManager>().activeCampaign != null)
                {
                    Debug.Log("Active Campaign isn't null!");
                    //Debug.Log(GetComponent<GameManager>().activeCampaign.toString());
                }
                if (GetComponent <GameManager>().activeCampaign.currentDungeon.dungeonMap != null)
                {
                    Debug.Log("Current dungeonmap isn't null!");
                }
                if (GetComponent <GameManager>().activeCampaign.listParty != null)
                {
                    Debug.Log("listParty isn't null!");
                }
            }
            if (s.Contains("Sending Dungeon of size: "))
            {
                int size = int.Parse(s.Substring(24));
                Debug.Log(size);
                for (int r = 0; r < size; r++)
                {
                    for (int c = 0; c < size; c++)
                    {
                    }
                }
            }
        }
        public void PromptPopup(ListPrompt p)
        {
            Debug.Log("Creating a prompt popup...");
            Text[] textComponents = new Text[0];
            switch (p.iNumSelectable)
            {
            case 1:
                createdPanel = (GameObject)Instantiate(dropdown1Panel, transform);
                createdPanel.transform.position      = new Vector3(0, 0, 0);
                createdPanel.transform.localPosition = new Vector3(0, 0, 0);
                textComponents = GetComponentsInChildren <Text>();
                promptText     = textComponents[0];
                dropdowns      = GetComponentsInChildren <Dropdown>();
                dropdowns[0].ClearOptions();
                dropdowns[0].AddOptions(p.sPromptOptions);
                button = GetComponentInChildren <Button>();
                button.onClick.AddListener(SubmitChoices);
                promptText.text = p.sPromptTitle;
                break;

            case 2:
                createdPanel = (GameObject)Instantiate(dropdown2Panel, transform);
                createdPanel.transform.position      = new Vector3(0, 0, 0);
                createdPanel.transform.localPosition = new Vector3(0, 0, 0);
                textComponents = GetComponentsInChildren <Text>();
                promptText     = textComponents[0];
                dropdowns      = GetComponentsInChildren <Dropdown>();
                button         = GetComponentInChildren <Button>();
                button.onClick.AddListener(SubmitChoices);
                promptText.text = p.sPromptTitle;
                break;

            case 3:
                createdPanel = (GameObject)Instantiate(dropdown3Panel, transform);
                createdPanel.transform.position      = new Vector3(0, 0, 0);
                createdPanel.transform.localPosition = new Vector3(0, 0, 0);
                textComponents = GetComponentsInChildren <Text>();
                promptText     = textComponents[0];
                dropdowns      = GetComponentsInChildren <Dropdown>();
                button         = GetComponentInChildren <Button>();
                button.onClick.AddListener(SubmitChoices);
                promptText.text = p.sPromptTitle;
                break;

            default: break;
            }
        }