Пример #1
0
    public override DialoguePanel createSubtree(DialogueController controller, Color color, Color textColor, DialogueNextPanel dnp, DialogueSplitPanel dsp, DialogueActionPanel dap)
    {
        DialoguePanel optionAPanel = optionA.createSubtree(controller, color, textColor, dnp, dsp, dap);
        DialoguePanel optionBPanel = optionB.createSubtree(controller, color, textColor, dnp, dsp, dap);

        return(dsp.preset(optionAPanel, optionBPanel, controller, color, textColor, text, optionAText, optionBText));
    }
Пример #2
0
    public DialogueNextPanel preset(DialoguePanel next, DialogueController controller, Color color, Color textColor, string text)
    {
        DialogueNextPanel panel = Instantiate(this, Vector3.zero, Quaternion.identity, controller.transform);

        panel.gameObject.SetActive(false);
        controller.Attach(panel);
        panel.next.onClick.AddListener(delegate
        {
            controller.Discard(panel);
            controller.Show(next);
        });
        panel.cancel.onClick.AddListener(delegate
        {
            controller.Cancel();
        });
        panel.textArea.text  = text;
        panel.textArea.color = textColor;
        Image[] images = panel.GetComponentsInChildren <Image>(true);
        foreach (Image i in images)
        {
            i.material.color = color;
        }

        return(panel);
    }
Пример #3
0
    private IEnumerator ShowDialog(float delay = 3f)
    {
        //dialog.gameObject.SetActive(true);
        DialoguePanel dialoguePanel = PanelManager.panelManager.GetPanelByType(BasePanel.PanelType.Dialogue) as DialoguePanel;

        dialoguePanel.OpenAndShow(dialogue);

        yield return(new WaitForSeconds(effects[0].delay));



        if (effects != null)
        {
            ActivateAllEffects();
        }
        else
        {
            Debug.Log("Effects was null");
        }

        //if(effects.Count > 0) {
        //    Debug.Log("more then 0 effects");
        //}
        //else {
        //    Debug.Log(" 0 effects");
        //}

        yield return(new WaitForSeconds(2.5f));

        dialoguePanel.HideDialoge();
    }
Пример #4
0
	public void Initialize()
	{
		_panels = new List<PanelBase>();
		Root = GameObject.Find("UI Root").GetComponent<UIRoot>();

		Root.manualHeight = Screen.height;
		Root.manualWidth = Screen.width;

		UICamera = Root.transform.Find("UICamera").GetComponent<Camera>();


		BarkPanel = UICamera.transform.Find("BarkPanel").GetComponent<BarkPanel>();
		BarkPanel.Initialize();

		HUDPanel = UICamera.transform.Find("HUDPanel").GetComponent<HUDPanel>();
		HUDPanel.Initialize();

		WindowPanel = UICamera.transform.Find("WindowPanel").GetComponent<WindowPanel>();
		WindowPanel.Initialize();

		DialoguePanel = UICamera.transform.Find("DialoguePanel").GetComponent<DialoguePanel>();
		DialoguePanel.Initialize();


		_panels.Add(DialoguePanel);
		_panels.Add(WindowPanel);
		_panels.Add(HUDPanel);
		_panels.Add(BarkPanel);


		UIStateMachine = new UIStateMachine();
		UIStateMachine.Initialize();
	}
Пример #5
0
    public override void _GuiInput(InputEvent @event)
    {
        var smh = @event;

        if (smh is InputEventMouseButton)
        {
            InputEventMouseButton iemb = (InputEventMouseButton)smh;
            if (iemb.Pressed)
            {
                SetTheme(pressed);
                isPressed = true;
            }
            else
            {
                DialoguePanel panel = (DialoguePanel)GetNode("../../../../");
                if (isPressed && over && panel.unlocked)
                {
                    var conn         = (Connection)GetNode("../../../../../../../Connection");
                    var optionPacket = new GUIOptionPacket(uuid);
                    conn.sendPacket(optionPacket);
                    panel.unlocked = false;
                }
                SetTheme(over ? hover : normal);
                isPressed = false;
            }
        }
    }
Пример #6
0
    public override DialoguePanel createSubtree(DialogueController controller, Color color, Color textColor, DialogueNextPanel dnp, DialogueSplitPanel dsp, DialogueActionPanel dap)
    {
        DialoguePanel panel = nextNode.createSubtree(controller, color, textColor, dnp, dsp, dap);

        controller.Show(panel);

        return(panel);
    }
Пример #7
0
 void Awake()
 {
     player         = GetComponent <Player>();
     playerMovement = GetComponent <PlayerMovement>();
     playerAnim     = GetComponent <PlayerAnimation>();
     ray            = GameManager.Instance.InteractableRaycaster;
     dialogue       = UIManager.Instance.DialoguePanel;
 }
Пример #8
0
    void Awake()
    {
        dialoguePanel = DialoguePanel.Instance ();

        myYesAction = new UnityAction (TestYesFunction);
        myNoAction = new UnityAction (TestNoFunction);
        myCancelAction = new UnityAction (TestCancelFunction);
    }
Пример #9
0
    public override void _Ready()
    {
        instance  = this;
        textLabel = FindNode("Text", true) as RichTextLabel;
        game      = this.FindParentOfType <Game>(true);

        Visible = false;
    }
Пример #10
0
    public static DialoguePanel Instance()
    {
        if (!dialoguePanel) {
            dialoguePanel = FindObjectOfType(typeof (DialoguePanel)) as DialoguePanel;
            if (!dialoguePanel)
                Debug.LogError ("There needs to be one active ModalPanel script on a GameObject in your scene.");
        }

        return dialoguePanel;
    }
Пример #11
0
        void Awake()
        {
            DialoguePanel  = UIManager.Instance.DialoguePanel;
            Indicator      = GetComponentInChildren <InteractableIndicator>();
            spriteRenderer = GetComponentInChildren <SpriteRenderer>();
            boxCollider    = GetComponent <BoxCollider2D>();
            InteractableRaycaster ray = GameManager.Instance.InteractableRaycaster;

            ray.OnInteractableClicked     += OnClicked;
            DialoguePanel.OnResetPlatform += DestroyShopkeeper;
        }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         DialoguePanel.hideOptions();
         Cursor.visible = false;
         this.gameObject.GetComponent <DialogueWithTrigger>().enter   = true;
         this.gameObject.GetComponent <DialogueWithTrigger>().counter = 0;
         this.gameObject.GetComponent <DialogueWithTrigger>().NextMessage();
         this.gameObject.active = false;
     }
 }
Пример #13
0
    // TODO: maybe make this private and change it so the class sends an event maybe to get the Thing param?
    public void BuildDialoguePanel(BaseCharacter thing)
    {
        _currentTargetThing = thing;
        HideUIPanel();

        var temp = Instantiate(_dialoguePanel);

        temp.transform.SetParent(_canvas.transform, false);
        DialoguePanel newPanel = temp.GetComponent <DialoguePanel>();

        newPanel.InitDialoguePanel(thing);
        UpdateCurrentPanel(newPanel.gameObject);
    }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Crate")
     {
         collision.GetComponent <BoxCollider2D>().enabled = false;
         DialoguePanel.hideOptions();
         Cursor.visible = false;
         this.GetComponent <DialogueEngine>().ChangeDialogueToID(id, true);
         this.gameObject.GetComponent <DialogueWithTrigger>().enter   = true;
         this.gameObject.GetComponent <DialogueWithTrigger>().counter = 0;
         this.gameObject.GetComponent <DialogueWithTrigger>().NextMessage();
     }
 }
Пример #15
0
    public static DialoguePanel Instance()
    {
        if (!dialoguePanel)
        {
            dialoguePanel = FindObjectOfType(typeof(DialoguePanel)) as DialoguePanel;
            if (!dialoguePanel)
            {
                Debug.Log("There needs to be one active DialoguePanel script on a GameObject in your scene.");
            }
        }

        return(dialoguePanel);
    }
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.E) && enter && !talking && Time.timeScale != 0.0f)
        {
            DialoguePanel.hideOptions();
            NextMessage();
            Interacted = true;
        }

        if (Time.timeScale == 0)
        {
            talking = true;
            Invoke("EnableTalking", 0.1f);
        }
    }
Пример #17
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.E) && enter && !talking && Time.timeScale != 0.0f)
        {
            GameObject.FindGameObjectWithTag("Sound").GetComponent <SoundScript>().normalClick();
            DialoguePanel.hideOptions();
            NextMessage();
            Interacted = true;
        }

        if (Time.timeScale == 0)
        {
            talking = true;
            Invoke("EnableTalking", 0.1f);
        }
    }
Пример #18
0
    public void ShowDialoguePanel(DialoguePanel panel, DialogueEvent callback)
    {
        state = DialogueState.loading;
        dialogueUI.SetActive(true);

        nameTMP.SetText(panel.nameText);

        textController.SetText(panel.bodyText);

        if (panel.settings.useCustomSpeed)
        {
            textController.speedMultiplier = panel.settings.speedMultiplier;
        }
        else
        {
            textController.speedMultiplier = 1f;
        }

        ableToContinue    = false;
        firstFrameEnabled = true;
        dialogueEvent     = callback;

        textController.StartReveal();
    }
Пример #19
0
 private void Awake()
 {
     dialoguePanel = GameObject.FindGameObjectWithTag("DialoguePanel").GetComponent <DialoguePanel>();
 }
Пример #20
0
 /// <summary>
 /// Initializes a Hero at the given position with the given dimensions
 /// </summary>
 /// <param name="x">X coordinate of the top-left corner</param>
 /// <param name="y">Y coordinate of the top-left corner</param>
 /// <param name="w">Width in pixels</param>
 /// <param name="h">Height in pixels</param>
 private Hero(int x, int y, int w, int h)
     : base(x, y, w, h, string.Empty)
 {
     ppSystem = new PickpocketSystem();
     ppActive = false;
     canShoot = true;
     shootTimer = 0.0f;
     dialogue = new DialoguePanel();
     monologue = new InnerMonologue();
     nerdRep = 0;
     jockRep = 0;
     prepRep = 0;
     bullyRep = 0;
     slackerRep = 0;
     healthBar = new HealthBarTexture();
     this.setHealth(DEFAULT_MAX_HEALTH);
     follower = PersonID.None;
 }