Exemplo n.º 1
0
    /// <summary>
    /// Gửi request kick người chơi
    /// </summary>
    void DoRequestKickPlayer(GameObject go)
    {
        if (GameModelChan.CurrentState >= GameModelChan.EGameState.dealClient)
        {
            NotificationView.ShowMessage("Bạn không thể đuổi người chơi khác trong khi ván bài đang diễn ra.");
            return;
        }

        UIContainerAnonymous anony = go.GetComponent <UIContainerAnonymous>();

        if (anony != null)
        {
            NotificationView.ShowConfirm("Xác nhận.", "Bạn có chắc rằng muốn đuổi người chơi " + ((EPlayerController)anony.intermediary).username + "\n\nRa khỏi bàn chơi không ?",
                                         delegate()
            {
                GameManager.Server.DoRequestPluginGame(Utility.SetEsObject(Fields.GAMEPLAY.PLAY, new object[] {
                    Fields.ACTION, "kickPlayer",
                    Fields.PLAYER.USERNAME, ((EPlayerController)anony.intermediary).username
                }));
            }, null);
        }
        else
        {
            Debug.LogError("Không tìm được người chơi");
        }
    }
Exemplo n.º 2
0
    public void UpdateButtonAddMeld()
    {
        while (listObjAddMeld.Count > 0)
        {
            GameObject.Destroy(listObjAddMeld[0].Value);
            listObjAddMeld.Remove(listObjAddMeld[0]);
        }

        if (GameModelPhom.game.listGiveCard.Count == 0)
        {
            return;
        }
        if (GameModelPhom.YourController.mCardMelds.Count == 0)
        {
            return;
        }

        if (GameModelPhom.game.ListClickCard.Count == 1 && GameModelPhom.game.listGiveCard.Find(gc => gc.cardId == GameModelPhom.game.ListClickCard[0].CardId) != null)
        #region CO BAN
        #endregion
        {
            #region ADVANCE
            foreach (GamePlayPhom.GiveCard give in GameModelPhom.game.listGiveCard.FindAll(gc => gc.cardId == GameModelPhom.game.ListClickCard[0].CardId))
            {
                PlayerControllerPhom p = GameModelPhom.GetPlayer(give.slotIndex);
                Meld meld      = p.GetMeld(give.meldResponse);
                int  indexMeld = p.mCardMelds.FindIndex(m => m == meld);

                int       side     = (int)GameModelPhom.GetPlayer(give.slotIndex).mSide;
                Transform trans    = GameModelPhom.game.mPlaymat.locationMelds[side];
                Vector3   position = GameModelPhom.game.mPlaymat.GetLocationMeld(GameModelPhom.GetPlayer(give.slotIndex), indexMeld, 2);
                position.z = -17;

                GameObject obj = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/Gameplay/btAddMeldPrefab"));
                obj.GetComponent <UIButtonMessage>().target = GameModelPhom.game.gameObject; //SendTo Gameplay Method OnClickAddMeldCard
                UIContainerAnonymous contaniner = obj.AddComponent <UIContainerAnonymous>();
                contaniner.intermediary = give;

                obj.transform.parent        = trans.parent;
                obj.transform.localPosition = position;
                obj.transform.localScale    = Vector3.one;

                listObjAddMeld.Add(new KeyValuePair <GamePlayPhom.GiveCard, GameObject>(give, obj));
            }
            #endregion
        }
    }
Exemplo n.º 3
0
    void SetDataPlayer(EPlayerController p, int i)
    {
        if (p != null)
        {
            UIContainerAnonymous anony = kickButton[i].gameObject.GetComponent <UIContainerAnonymous>();
            if (anony == null)
            {
                anony = kickButton[i].gameObject.AddComponent <UIContainerAnonymous>();
            }
            anony.intermediary = p;
        }

        Texture avatar = null;

        if (p != null)
        {
            p.AvatarTexture(delegate(Texture _texture) { avatar = _texture; });
        }

        string username = p != null ? p.username : "";

        kickAvatar[i].mainTexture = swappedAvatar[i].mainTexture = avatar;

        Color white = Color.white;

        if (p == null)
        {
            white.a = 0f;
        }
        kickAvatar[i].color = swappedAvatar[i].color = white;

        kickUsername[i].text = swappedUsername[i].text = username;

        kickButton[i].gameObject.SetActive(p != null);
        kickAvatar[i].gameObject.SetActive(p != null);

        int slot = GameModelChan.YourController.slotServer;

        slot += (i + 1);
        if (slot >= 4)
        {
            slot -= 4;
        }

        swappedAvatar[i].gameObject.GetComponent <UIContainerAnonymous>().valueInt = slot;
    }
Exemplo n.º 4
0
    public virtual void DoRequestKickPlayer(GameObject go)
    {
        UIContainerAnonymous anony = go.GetComponent <UIContainerAnonymous>();

        if (anony != null)
        {
            NotificationView.ShowConfirm("Xác nhận.", "Bạn có chắc rằng muốn đuổi người chơi " + ((EPlayerController)anony.intermediary).username + "\n\nRa khỏi bàn chơi không ?",
                                         delegate()
            {
                GameManager.Server.DoRequestPluginGame(Utility.SetEsObject(Fields.GAMEPLAY.PLAY, new object[] {
                    Fields.ACTION, "kickPlayer",
                    Fields.PLAYER.USERNAME, ((EPlayerController)anony.intermediary).username
                }));
            }, null);
        }
        else
        {
            Debug.LogError("Không tìm được người chơi");
        }
    }
Exemplo n.º 5
0
    public virtual void SetDataPlayer(EPlayerController p, int i)
    {
        if (p != null)
        {
            UIContainerAnonymous anony = kickButton[i].gameObject.GetComponent <UIContainerAnonymous>();
            if (anony == null)
            {
                anony = kickButton[i].gameObject.AddComponent <UIContainerAnonymous>();
            }
            anony.intermediary = p;
        }

        Texture avatar = null;

        if (p != null)
        {
            p.AvatarTexture(delegate(Texture _texture) { avatar = _texture; });
        }

        string username = p != null ? p.username : "";

        kickAvatar[i].mainTexture = swappedAvatar[i].mainTexture = avatar;

        Color white = Color.white;

        if (p == null)
        {
            white.a = 0f;
        }
        kickAvatar[i].color = swappedAvatar[i].color = white;

        kickUsername[i].text = swappedUsername[i].text = username;

        kickButton[i].gameObject.SetActive(p != null);
        kickAvatar[i].gameObject.SetActive(p != null);
    }