Esempio n. 1
0
    void SwapModes()
    {
        if (mode == CanvasMode.NPCText)
        {
            choicesCanvas.SetActive(true);
            dialogueCanvas.SetActive(false);

            DialogueChoice[] choices = tree.GetChoices();

            if (choices != null && choices.Length > 0)
            {
                for (int i = 0; i < choices.Length; i++)
                {
                    GameObject buttonGO = Instantiate(choiceButtonPrefab);
                    buttonGO.transform.SetParent(choicesWindow.transform);

                    Button button = buttonGO.GetComponent <Button>();
                    button.GetComponentInChildren <Text>().text  = choices[i].successSentence;
                    button.GetComponentInChildren <Text>().color = new Color(255, 255, 255, 255);

                    button.onClick.AddListener(() => OnChoiceClicked(button));

                    button.name = i.ToString() + " " + choices[i].successSentence;
                }
            }
            else
            {
                //Is there a branch to take?
                if (OnBranchTaken != null)
                {
                    OnBranchTaken();
                }

                //Reached the end of tree
                Deactivate();
            }



            mode = CanvasMode.PlayerText;
            return;
        }
        else
        {
            choicesCanvas.SetActive(false);
            dialogueCanvas.SetActive(true);

            dialogueText.text = tree.AdvanceToNextSentence();

            int children = choicesWindow.transform.childCount;

            for (int i = 0; i < children; i++)
            {
                Destroy(choicesWindow.transform.GetChild(i).gameObject);
            }

            mode = CanvasMode.NPCText;
            return;
        }
    }
Esempio n. 2
0
    public void Activate()
    {
        gameObject.SetActive(true);

        choicesCanvas.SetActive(false);
        dialogueCanvas.SetActive(true);

        mode = CanvasMode.NPCText;
        dialogueText.text = tree.AdvanceToNextSentence();
    }
        private void OnScaleModeChanged(CanvasMode mode)
        {
            switch (mode)
            {
            case CanvasMode.ScaleWithScreenSize:
                Scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
                break;

            default:
                Scaler.uiScaleMode = CanvasScaler.ScaleMode.ConstantPixelSize;
                break;
            }
        }
Esempio n. 4
0
        public BasicCanvas(CanvasMode mode, string name, int w, int h)
        {
            if(w < 0)
                throw new ArgumentException("Width cannot be < 0", "w");

            if(h < 0)
                throw new ArgumentException("Height cannot be < 0", "h");

            Mode = mode;
            Name = name;
            Width = w;
            Height = h;

            _data = new Color[w, h];
            for (int y = 0; y < h; ++y)
            {
                for (int x = 0; x < w; ++x)
                {
                    _data[x, y] = new Color();
                }
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Sets the InkManager(s) to Erase mode
 /// </summary>
 private void EraseMode()
 {
     m_InkManager.Mode = InkManipulationMode.Erasing;
     m_HighLightManager.Mode = InkManipulationMode.Erasing;
     m_CurrentMode = CanvasMode.Erase;
     //selCanvas.style.cursor = "url(images/erase.cur), auto";
 }
Esempio n. 6
0
 /// <summary>
 /// Starts the selecting mode
 /// </summary>
 private void SelectMode()
 {
     //m_InkManager.Mode = InkManipulationMode.Selecting;
     m_CurrentMode = CanvasMode.Select;
 }
Esempio n. 7
0
 /// <summary>
 /// Sets the Drawing InkManager as the CurrentManager
 /// </summary>
 private void InkMode()
 {
     m_CurrentMode = CanvasMode.Ink;
     m_InkManager.Mode = InkManipulationMode.Inking;
     SetDefaults(CurrentDrawingSize, CurrentDrawingColor);
 }
Esempio n. 8
0
 /// <summary>
 /// Sets the Highlighting InkManager as the CurrentManager
 /// </summary>
 private void HighlightMode()
 {
     m_CurrentMode = CanvasMode.Highlight;
     m_HighLightManager.Mode = InkManipulationMode.Inking;
     SetDefaults(CurrentHighlightSize, CurrentHighlightColor);
 }
Esempio n. 9
0
 public void SetMode(CanvasMode mode)
 {
     switch (mode)
     {
         case CanvasMode.Ink:
             InkMode();
             break;
         case CanvasMode.Highlight:
             HighlightMode();
             break;
         case CanvasMode.Erase:
             EraseMode();
             break;
         case CanvasMode.Select:
             SelectMode();
             break;
     }
 }