示例#1
0
    public void NoButtonChallenge()
    {
        string[]      splits = SingletonUI.Instance.ChallengeText.text.Split(' ');
        MessagePacket packet = new MessagePacket(GameProtocol.ChallengeRefusedPacketID(), Singleton.Instance.Me.Username + ":" + splits[0]);

        Singleton.Instance.Connection.SendPacket(packet.getData());
        Singleton.Instance.Me.IsChallenged = false;
        gameObject.SetActive(false);
    }
示例#2
0
        //Function called when you get a challenge.
        public IEnumerator getChallenged()
        {
            if (!SingletonUI.Instance.LogoutModalPanel.activeSelf)
            {
                Singleton.Singleton.Instance.Me.IsChallenged       = true;
                SingletonUI.Instance.AcceptChallengeButton.enabled = true;
                SingletonUI.Instance.AcceptChallengeButton.GetComponent <Image>().color = SingletonUI.Instance.defaultButtonCollor;
                SingletonUI.Instance.ChallengePanel.SetActive(true);
                SingletonUI.Instance.ChallengeText.text = Message;
            }
            else
            {
                //If u get challenge when logout panel is active refuse them and dont show the challenge panel.
                string[]      splits = Message.Split(' ');
                MessagePacket packet = new MessagePacket(GameProtocol.ChallengeRefusedPacketID(),
                                                         Singleton.Singleton.Instance.Me.Username + ":" + splits[0]);
                Singleton.Singleton.Instance.Connection.SendPacket(packet.getData());
                Singleton.Singleton.Instance.Me.IsChallenged = false;
                SingletonUI.Instance.ChallengePanel.SetActive(false);
            }

            yield return(null);
        }
示例#3
0
        //Open Logout panel.
        public void logoutAction()
        {
            //IF the challenge panel is active then send to the callenger refuse and close the panel
            if (SingletonUI.Instance.ChallengePanel.activeSelf)
            {
                string[]      splits = SingletonUI.Instance.ChallengeText.text.Split(' ');
                MessagePacket packet = new MessagePacket(GameProtocol.ChallengeRefusedPacketID(),
                                                         Singleton.Singleton.Instance.Me.Username + ":" + splits[0]);
                Singleton.Singleton.Instance.Connection.SendPacket(packet.getData());
                Singleton.Singleton.Instance.Me.IsChallenged = false;
                SingletonUI.Instance.ChallengePanel.SetActive(false);
            }

            //Destroy every result panels ( if exists)
            var list = SingletonUI.Instance.Helper.GetComponentsInChildren <ChallengeResultScript>();

            foreach (ChallengeResultScript x in list)
            {
                x.destroyMyself();
            }

            SingletonUI.Instance.LogoutModalPanel.SetActive(true);
        }