Beispiel #1
0
        public void UpdateDeskDes(bool force = false)
        {
            //int t = (int)(max_no_operation - no_operation);
            //if (force || last_t != t)
            //{
            //    last_t = t;
            int    desk_level = self.desk_idx / 10;
            string desk_des   = $"\n\n\n\n{RoomObj.GetRoomLevelName(self.level)}蛐蛐房>{RoomDeskObj.GetDeskLevelName(desk_level)}{(self.desk_idx % 10 + 1)}号桌<size=22><color=red>\n\n{loves[0]}\n\n{loves[1]}</color></size>";

            //    if (QuquDesk.instance.no_operation > 0)
            //    {
            //        switch (self.ready)
            //        {
            //            case 0:
            //                desk_des = $"{desk_des}\n请在{t}秒内确认!";
            //                break;

            //            case 1:
            //                desk_des = $"{desk_des}\n请在{t}秒内准备!";
            //                break;
            //        }
            //    }
            tBattleDeskName.text = desk_des;
            //}
        }
Beispiel #2
0
        //float size = 0.3f;
        //float x = 0;
        //float y = 0;
        //void OnGUI()
        //{
        //    if (GUI.Button(new Rect(50, 50, 100, 50), "调整PlayerItem"))
        //    {
        //        GameObject go = actorFace.gameObject;
        //        RectTransform tf = (RectTransform)go.transform;
        //        tf.anchoredPosition = new Vector2(x, y);
        //        tf.localScale = Vector3.one * size;
        //    }
        //    float.TryParse(GUI.TextField(new Rect(150, 50, 100, 50), size.ToString()), out size);
        //    float.TryParse(GUI.TextField(new Rect(250, 50, 100, 50), x.ToString()), out x);
        //    float.TryParse(GUI.TextField(new Rect(350, 50, 100, 50), y.ToString()), out y);
        //}

        public void SetData(PlayerData playerData)
        {
            if (!gameObject.activeSelf)
            {
                gameObject.SetActive(true);
            }
#if !TAIWU_GAME
            if (null != playerData && playerData.ip != "0")
            {
                Tools.UpdateFace(last_image, actorFace, playerData.age, playerData.gender, playerData.actorGenderChange, playerData.faceDate, playerData.faceColor, playerData.clotheId, true);
            }
#endif
            if (this.ip == playerData.ip && this.desk_idx == playerData.desk_idx && this.observer == playerData.observer && this.level == playerData.level)
            {
                return;
            }



            text.text = playerData.player_name;
            if (playerData.level == -1)
            {
                alpha = .2f;
                // // Main.Logger.Log(playerData.level+" "+ playerData.desk_idx+" "+ playerData.observer + "\n<size=30>(正在大厅中闲逛)</size>");
                text.text += "\n<size=30>(正在大厅中闲逛)</size>";
            }
            else if (playerData.desk_idx == -1)
            {
                alpha = 1;
                // // Main.Logger.Log(playerData.level + " " + playerData.desk_idx + " " + playerData.observer + $"\n<size=25>(正在{RoomObj.GetRoomLevelName(playerData.level)}蛐蛐房中闲逛)</size>");
                text.text += $"\n<size=20>(正在{RoomObj.GetRoomLevelName(playerData.level)}蛐蛐房中闲逛)</size>";
            }
            else
            {
                alpha = 1;
                // // Main.Logger.Log(playerData.level + " " + playerData.desk_idx + " " + playerData.observer + $"\n<size=20>(在{RoomObj.GetRoomLevelName(playerData.level)}房{RoomDeskObj.GetDeskLevelName(playerData.desk_idx / 10)}{(playerData.desk_idx % 10 + 1)}桌中{(playerData.observer == 0 ? "对战" : "观战")})</size>");
                text.text += string.Format($"\n<size=22>(在{RoomObj.GetRoomLevelName(playerData.level)}房{RoomDeskObj.GetDeskLevelName(playerData.desk_idx / 10)}{(playerData.desk_idx % 10 + 1)}桌中{(playerData.observer == 0?"对战":"观战")})</size>");
            }

            SetColor(playerData.ip);
            LayoutRebuilder.ForceRebuildLayoutImmediate(rText);
            rtf.sizeDelta = new Vector2(rtf.sizeDelta.x, rText.sizeDelta.y + 10);

            this.ip       = playerData.ip;
            this.desk_idx = playerData.desk_idx;
            this.observer = playerData.observer;
        }
Beispiel #3
0
        void OnDeskData(string error, long time_stamp, DeskData deskData, string battle_flag)
        {
            next_auto_send_time = Time.time + auto_send_interval;
            if (null == error)
            {
                tPeopleNum.text = "";
                self.time_stamp = time_stamp;
                if (all.activeSelf && self.desk_idx != -1)
                {
                    if (!desk.gameObject.activeSelf)
                    {
                        this.hall.SetActive(false);
                        this.room.SetActive(false);
                        this.desk.SetActive(true);
                        this.chat.SetActive(true);
                        this.people.SetActive(false);
                        int desk_level = self.desk_idx / 10;
                        tTitle.text   = $"{self.player_name} 大厅>{RoomObj.GetRoomLevelName(self.level)}蛐蛐房>{RoomDeskObj.GetDeskLevelName(desk_level)}{(self.desk_idx % 10 + 1)}号桌";
                        go_close.name = "1556454954,1556454954";
                    }

                    // 聊天
                    ChatData[] chatDatas = deskData.chat_data.ToArray();
                    ququChat.SetData(chatDatas);

                    // 对战桌
                    ququDesk.SetData(deskData);
                }
                else if (!all.activeSelf)
                {
                    tPeopleNum.text = "返回赌桌 " + PlayerData.online_count + "人在线";
                }
                UpdateBetAndQuqu();

                if (!int.TryParse(battle_flag, out int tmp)) // 触发战斗
                {
                    // // // Main.Logger.Log("触发战斗"+ battle_flag);
                    self.ready = 0; // 准备战斗恢复为未准备
                    if (self.observer > 1)
                    {
                        self.observer = 1; // 押注观战恢复为普通观战
                    }
                    PlayBattle(battle_flag);
                }
                else
                {
                    // // // Main.Logger.Log("不触发战斗"+ battle_flag);
                }
                //OnLose();
            }
            else
            {
                self.desk_idx = -1;
                //YesOrNoWindow.instance.SetYesOrNoWindow(-1, "出错!", error, false, true);
                // // Main.Logger.Log("error" + error);
                GetData();
            }
        }