コード例 #1
0
    public void DisplayInputFeedback()
    {
        InputInfo inputInfo = InputInfo.GetCurrent;

        // check if ANYTHING has been recognized
        if (!inputInfo.HasItems() && !inputInfo.HasVerb())
        {
            if (debug)
            {
                Debug.LogError("no verb, no items");
            }

            DisplayFeedback.Instance.Display("Quoi ?");
            return;
        }

        // check if verb has been recognized
        if (!inputInfo.HasVerb())
        {
            if (debug)
            {
                Debug.LogError("no verb");
            }
            string str = "Que faire avec &le chien (main item)&";
            Phrase.Write(str);
            return;
        }

        // check if item has been recognized
        if (inputInfo.HasVerb() && !inputInfo.HasItems())
        {
            if (debug)
            {
                Debug.LogError("only verb, no item");
            }

            // get verb only action
            Item verbItem = Item.GetDataItem("verbe seul");
            inputInfo.AddItem(verbItem);
            inputInfo.FindCombination();

            // no verb, displaying thing
            if (inputInfo.combination == null)
            {
                string str = inputInfo.verb.question + " voulez vous " + inputInfo.verb.names[0];
                str = TextManager.WithCaps(str);
                DisplayFeedback.Instance.Display(str);
                return;
            }
        }

        // verb / item combinaison doesn't exist
        if (inputInfo.combination == null)
        {
            if (debug)
            {
                Debug.LogError("Fail : no combination between verb : " + inputInfo.verb.names[0] + " and item : " + inputInfo.MainItem.word.text);
            }

            string str;

            if (inputInfo.verb.preposition.Length != 0)
            {
                str = "Vous ne pouvez pas " + inputInfo.verb.names[0] + " " + inputInfo.verb.preposition + " &le chien (main item)&";
            }
            else
            {
                str = "Vous ne pouvez pas " + inputInfo.verb.names[0] + " &le chien (main item)&";
            }

            Phrase.Write(str);
            return;
        }

        if (debug)
        {
            Debug.LogError("no action");
        }
        // get cell content
        string[] lines = inputInfo.combination.content.Split('\n');

        // separate all actions
        foreach (var line in lines)
        {
            // parse action
            PlayerAction action = GetAction(line);

            if (action != null)
            {
                action.Call();
                onPlayerAction(action);

                if (breakActions)
                {
                    Debug.Log(" !!!!! ACTION SEARCH IS STOPPED DUE TO THING !!!! ");
                    breakActions = false;
                    break;
                }
            }
        }
    }