public void SetPlayerShow(bool show, int desk_id, int pos) { this.desk_id = desk_id; this.show_player = show; this.pos = pos; if (show) { PlayerData playerData = null; PlayerData[] list = DataFile.instance.hall_data.room_data[PlayerData.self.level].player_data; for (int i = 0; i < list.Length; i++) { if (list[i].desk_idx == desk_id && list[i].level == PlayerData.self.level && list[i].desk_pos == pos) { playerData = list[i]; break; } } #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); } else { Tools.UpdateFace(last_image, actorFace, 0, 0, 0, new int[] { 3102 }, new int[] { 3102 }, 0, true); } #endif } else { #if !TAIWU_GAME // 3102是侠士 3101是外道 actorFace.UpdateFace(0, 0, 0, 0, new int[] { 3102 }, null, 0); #endif } }
//float size = 0.3f; //float x = 0; //float y = 0; //PlayerData p; //void OnGUI() //{ // if (null != p) // { // if (GUI.Button(new Rect(50, 250, 100, 50), "调整PlayerObj")) // { // 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, 250, 100, 50), size.ToString()), out size); // float.TryParse(GUI.TextField(new Rect(250, 250, 100, 50), x.ToString()), out x); // float.TryParse(GUI.TextField(new Rect(350, 250, 100, 50), y.ToString()), out y); // } //} public void SetData(PlayerData playerData, int i) { pos = i; this.data = playerData; show_player = playerData.ip != "0"; if (!show_player) // 空位 { text.text = "虚位以待"; text.color = Color.gray; shadow.effectColor = Color.white; actorFace.UpdateFace(0, 0, 0, 0, new int[] { 1 }, null, 0); } else { if (playerData.observer == 0) // 选手 { int ready = playerData.ready; if (ready == -1) { ready = 3; } else if (ready == -2) { ready = 4; } text.text = string.Format(name_format_str, playerData.player_name, ready_state_str[ready % ready_state_str.Length]); } else // 观战者 { int observer = playerData.observer; if (playerData.ready == -1) { observer = 4; } else if (playerData.ready == -2) { observer = 5; } string bet_player_name = bet_state_str[observer % bet_state_str.Length]; if (playerData.observer > 1 && playerData.ready != -1) { PlayerData sel = QuquDesk.instance.GetPlayer(playerData.observer - 2); if (sel.ip != "0") { bet_player_name = string.Format(bet_player_name, sel.player_name); } else { bet_player_name = string.Format(bet_player_name, (playerData.observer == 2 ? "左" : "右") + "边选手"); } } text.text = string.Format(name_format_str, playerData.player_name, bet_player_name); } SetColor(playerData.ip); } #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); } else { Tools.UpdateFace(last_image, actorFace, 0, 0, 0, new int[] { 3102 }, new int[] { 3102 }, 0, true); } #endif }