Пример #1
0
    public void init(int transfers, bool resetPos = true)
    {
        m_OtherMenu = m_propMenus [1];
        foreach (PropertyMenu pm in m_propMenus)
        {
            foreach (GameObject go in pm.propertyButtons)
            {
                if (CanSelectProperty(go.GetComponent <ButtonProperty>().SelectedProperty, m_OtherMenu))
                {
                    go.GetComponent <Image> ().color = m_normalColor;
                }
                else
                {
                    go.GetComponent <Image> ().color = m_deactiveColor;
                }
            }
            m_OtherMenu = m_propMenus [0];
        }
        if (resetPos)
        {
            m_listSelected = 0;
            m_propSelected = 0;
        }
        m_CurrentMenu = m_propMenus [m_listSelected];
        int otherMenu = (int)((m_listSelected + 1) % 2);

        m_OtherMenu    = m_propMenus [otherMenu];
        m_propSelected = Mathf.Min(m_CurrentMenu.NumProps() - 1, m_propSelected);
        if (m_propSelected < 0)
        {
            SwapLists();
            m_propSelected = 0;
            m_propSelected = Mathf.Min(m_CurrentMenu.NumProps() - 1, m_propSelected);
        }
        if (m_propSelected < 0)
        {
            m_infoText.text = "No Properties Available";
            exit_time       = 1.0f;
            ExitMenu();
            return;
        }
        m_timeSinceExit      = 0.0f;
        m_transfersRemaining = transfers;
        //m_remainingText.text = "Transfers Remaining: \n" + transfers.ToString ();
        m_selectedButton = m_CurrentMenu.propertyButtons [m_propSelected];
        HighlightKey(m_selectedButton);
        PauseGame.SlowToPause();
        PauseGame.CanPause   = false;
        starting             = true;
        m_active             = true;
        m_remainingText.text = "";
        m_reminderText.text  = "Use Movement Keys to Highlight \n" + "Press " + TextboxManager.GetKeyString("Cancel") + " to Exit Menu";
    }
Пример #2
0
 internal void OnTriggerEnter2D(Collider2D other)
 {
     if (autoTrigger && other.gameObject.GetComponent <BasicMovement> ())
     {
         TriggerWithCoolDown(other.gameObject);
     }
     if (other.gameObject.GetComponent <Interactor> () != null)
     {
         m_prompt.text = "Press " + TextboxManager.GetKeyString("Interact") + " to " + InteractionPrompt;
         FindObjectOfType <GUIHandler> ().ReplaceText(m_prompt);
         Actor = other.gameObject.GetComponent <Interactor> ();
         Actor.PromptedInteraction = this;
     }
 }
Пример #3
0
    // Update is called once per frame

    /* Cutscene scripting guide:
     *  Normal text is shown as dialogue for the starting character.
     *  Using the '|' character or the enter character will create a new textbox.
     *  At the start of a new textbox if the colon character is found within the first 18 characters, the game will attempt to search
     *  For the character and make the dialogue come from that character instead.
     *
     *  The character ` surrounds a special block.
     * A number will result in a pause for a certain amount of time.
     * $ will change the text speed
     *
     * --NOT IMPLEMENTED YET--
     * > will make a character walk to another character. Needs to be followed by the character name.
     * < will make them walk away
     * ] will make them face a character
     * [ will make them face away.
     * Any text means the character would try to do an animation
     * --NOT IMPLEMENTED YET--
     * */
    void Update()
    {
        if (targetedObj != null)
        {
            transform.position += targetedObj.transform.position - lastPos;
            //transform.position = targetedObj.transform.position;
            lastPos = targetedObj.transform.position;
        }
        if (typing)
        {
            if (lastCharacter < FullText.Length)
            {
                sinceLastChar  += Time.deltaTime;
                sinceLastSound += Time.deltaTime;
                if (sinceLastChar > timeBetweenChar)
                {
                    if (pauseTime > 0f)
                    {
                        pauseTime -= Time.deltaTime;
                    }
                    else
                    {
                        lastCharacter++;
                        char nextChar = FullText.ToCharArray() [lastCharacter - 1];
                        if (nextChar == '`')
                        {
                            //Debug.Log ("Start special section");
                            string actStr = "";
                            lastCharacter++;
                            nextChar = FullText.ToCharArray() [lastCharacter - 1];
                            //Debug.Log (nextChar);
                            string action = "pause";
                            float  res;
                            string test = "";
                            test += nextChar;
                            if (float.TryParse(test, out res))
                            {
                            }
                            else
                            {
                                if (nextChar == '!')
                                {
                                    action = "control";
                                }
                                else if (nextChar == '@')
                                {
                                    action = "camera";
                                }
                                else if (nextChar == '#')
                                {
                                    action = "scene";
                                }
                                else if (nextChar == ']')
                                {
                                    action = "faceTowards";
                                }
                                else if (nextChar == '[')
                                {
                                    //Debug.Log ("Correct Char");
                                    action = "faceAway";
                                }
                                else if (nextChar == '>')
                                {
                                    action = "walkTowards";
                                }
                                else if (nextChar == '<')
                                {
                                    action = "walkAway";
                                }
                                else if (nextChar == '$')
                                {
                                    action = "textSpeed";
                                }
                                else if (nextChar == '&')
                                {
                                    action = "key";
                                }
                                else
                                {
                                    lastCharacter--;
                                    action = "animation";
                                }
                                lastCharacter++;
                                nextChar = FullText.ToCharArray() [lastCharacter - 1];
                            }
                            bool   numFound = false;
                            string num      = "";
                            //string targetChar = null;
                            while (nextChar != '`')
                            {
                                if ((action == "walkTowards" || action == "walkAway") && nextChar == '-')
                                {
                                    numFound = true;
                                }
                                else
                                {
                                    if (numFound == true)
                                    {
                                        num += nextChar;
                                    }
                                    else
                                    {
                                        actStr += nextChar;
                                    }
                                    lastCharacter++;
                                    nextChar = FullText.ToCharArray() [lastCharacter - 1];
                                }
                            }
                            if (action == "control")
                            {
                                toggleControl(actStr);
                            }
                            else if (action == "camera")
                            {
                                cameraTarget(actStr);
                            }
                            else if (action == "walkTowards")
                            {
                                //Debug.Log ("Walking towards: " + actStr);
                                walkToPoint(actStr);

                                /*if (num.Length < 1) {
                                 *      //masterSequence.walkToChar (targetChar, actStr, 1f);
                                 * } else {
                                 *      //masterSequence.walkToChar (targetChar, actStr, float.Parse(num));
                                 * }*/
                            }
                            else if (action == "walkAway")
                            {
                            }
                            else if (action == "faceTowards")
                            {
                                facePoint(actStr);
                                //Debug.Log ("Facing towards");
                                //masterSequence.turnTowards (targetChar, actStr, true);
                            }
                            else if (action == "faceAway")
                            {
                                facePoint(actStr, true);
                                //Debug.Log ("facing away");
                                //masterSequence.turnTowards (targetChar, actStr, false);
                            }
                            else if (action == "animation")
                            {
                                playAnimation(actStr);
                            }
                            else if (action == "textSpeed")
                            {
                                timeBetweenChar = float.Parse(actStr);
                            }
                            else if (action == "key")
                            {
                                CurrentText += TextboxManager.GetKeyString(actStr);
                            }
                            else if (action == "scene")
                            {
                                Initiate.Fade(actStr, Color.white, 2.0f);
                            }
                            else
                            {
                                pauseTime = float.Parse(actStr);
                            }
                        }
                        else
                        {
                            if (sinceLastSound > 0.15f)
                            {
                                sinceLastSound = 0f;
                                playSound();
                            }
                            CurrentText  += nextChar;
                            mText.text    = CurrentText;
                            sinceLastChar = 0f;
                        }
                    }
                }
            }
            else
            {
                timeSinceStop += Time.deltaTime;
                if (timeSinceStop > pauseAfterType)
                {
                    Destroy(gameObject);
                }
            }
        }
    }
Пример #4
0
 public override void PerformAction(string actionString, Textbox originTextbox)
 {
     originTextbox.CurrentText += TextboxManager.GetKeyString(ExtractArgs(actionString, "&")[0]);
 }
Пример #5
0
 public override string PerformAction(string actionString, Textbox originTextbox)
 {
     return(TextboxManager.GetKeyString(ExtractArgs(actionString, "&")[0]));
 }