void OnGUI() { GUI.Button(new Rect(0, 0, 100, 30), "Euipments 1"); GUI.Button(new Rect(100, 0, 100, 30), "Euipments 2"); GUI.Button(new Rect(200, 0, 100, 30), "Euipments 3"); for (int i = 0; i < weapon_list.Length; i++) { if (GUI.Button(new Rect(i * 100, 30, 100, 50), "Weapon" + (weapon_list[i] ? "(√)" : ""))) { if (!weapon_list [i]) { for (int j = 0; j < weapon_list.Length; j++) { weapon_list [j] = false; } weapon_list [i] = true; character.ChangeWeapon("ch_we_one_hou_" + index[i]); } } } for (int i = 0; i < head_list.Length; i++) { if (GUI.Button(new Rect(i * 100, 80, 100, 50), "Head" + (head_list[i] ? "(√)" : ""))) { if (!head_list [i]) { for (int j = 0; j < head_list.Length; j++) { head_list [j] = false; } head_list [i] = true; character.ChangeHeadEquipment("ch_pc_hou_" + index[i] + "_tou", combine); } } } for (int i = 0; i < chest_list.Length; i++) { if (GUI.Button(new Rect(i * 100, 130, 100, 50), "Chest" + (chest_list[i] ? "(√)" : ""))) { if (!chest_list [i]) { for (int j = 0; j < chest_list.Length; j++) { chest_list [j] = false; } chest_list [i] = true; character.ChangeChestEquipment("ch_pc_hou_" + index[i] + "_shen", combine); } } } for (int i = 0; i < hand_list.Length; i++) { if (GUI.Button(new Rect(i * 100, 180, 100, 50), "Hand" + (hand_list[i] ? "(√)" : ""))) { if (!hand_list [i]) { for (int j = 0; j < hand_list.Length; j++) { hand_list [j] = false; } hand_list [i] = true; character.ChangeHandEquipment("ch_pc_hou_" + index[i] + "_shou", combine); } } } for (int i = 0; i < feet_list.Length; i++) { if (GUI.Button(new Rect(i * 100, 230, 100, 50), "Feet" + (feet_list[i] ? "(√)" : ""))) { if (!feet_list [i]) { for (int j = 0; j < feet_list.Length; j++) { feet_list [j] = false; } feet_list [i] = true; character.ChangeFeetEquipment("ch_pc_hou_" + index[i] + "_jiao", combine); } } } if (GUI.Button(new Rect(Screen.width - 100, 0, 100, 50), character.animationState == 0 ? "Attack" : "Stand")) { if (character.animationState == 0) { character.PlayAttack(); } else { character.PlayStand(); } } if (GUI.Button(new Rect(Screen.width - 100, 50, 100, 50), character.rotate ? "Static" : "Rotate")) { if (character.rotate) { character.rotate = false; } else { character.rotate = true; } } if (GUI.Button(new Rect(Screen.width - 150, 100, 150, 50), combine ? "Merge materials(√)" : "Merge materials")) { combine = !combine; } }
void OnGUI() { float btnWidth = 100.0f; float btnHeight = 100.0f; float btnPosY = btnHeight + 5.0f; GUI.Button(new Rect(0, 0, btnWidth, btnHeight), "Euipments 1"); GUI.Button(new Rect(btnWidth, 0, btnWidth, btnHeight), "Euipments 2"); GUI.Button(new Rect(btnWidth * 2, 0, btnWidth, btnHeight), "Euipments 3"); for (int i = 0; i < weapon_list.Length; i++) { if (GUI.Button(new Rect(i * btnWidth, btnPosY, btnWidth, btnHeight), "武器" + (weapon_list[i] ? "(√)" : ""))) { if (!weapon_list [i]) { for (int j = 0; j < weapon_list.Length; j++) { weapon_list [j] = false; } weapon_list [i] = true; character.ChangeWeapon("ch_we_one_hou_" + index[i]); } } } for (int i = 0; i < head_list.Length; i++) { if (GUI.Button(new Rect(i * btnWidth, btnPosY * 2, btnWidth, btnHeight), "头" + (head_list[i] ? "(√)" : ""))) { if (!head_list [i]) { for (int j = 0; j < head_list.Length; j++) { head_list [j] = false; } head_list [i] = true; character.ChangeHeadEquipment("ch_pc_hou_" + index[i] + "_tou", combine); } } } for (int i = 0; i < chest_list.Length; i++) { if (GUI.Button(new Rect(i * btnWidth, btnPosY * 3, btnWidth, btnHeight), "身体" + (chest_list[i] ? "(√)" : ""))) { if (!chest_list [i]) { for (int j = 0; j < chest_list.Length; j++) { chest_list [j] = false; } chest_list [i] = true; character.ChangeChestEquipment("ch_pc_hou_" + index[i] + "_shen", combine); } } } for (int i = 0; i < hand_list.Length; i++) { if (GUI.Button(new Rect(i * btnWidth, btnPosY * 4, btnWidth, btnHeight), "手" + (hand_list[i] ? "(√)" : ""))) { if (!hand_list [i]) { for (int j = 0; j < hand_list.Length; j++) { hand_list [j] = false; } hand_list [i] = true; character.ChangeHandEquipment("ch_pc_hou_" + index[i] + "_shou", combine); } } } for (int i = 0; i < feet_list.Length; i++) { if (GUI.Button(new Rect(i * btnWidth, btnPosY * 5, btnWidth, btnHeight), "腿" + (feet_list[i] ? "(√)" : ""))) { if (!feet_list [i]) { for (int j = 0; j < feet_list.Length; j++) { feet_list [j] = false; } feet_list [i] = true; character.ChangeFeetEquipment("ch_pc_hou_" + index[i] + "_jiao", combine); } } } if (GUI.Button(new Rect(Screen.width - btnWidth, 0, btnWidth, btnHeight), "getState")) { App.Game.character.mainRoleState.printRoleState(); } if (GUI.Button(new Rect(Screen.width - btnWidth, btnPosY, btnWidth, btnHeight), "镜头复原")) { App.Game.character.rolePosCamer.resetCamerPosFromRole(); } if (GUI.Button(new Rect(Screen.width - btnWidth, btnPosY * 2, btnWidth, btnHeight), "Escape")) { /* * Generator3D tmpMaze = this.gameObject.transform.GetComponent<Generator3D>(); * if (tmpMaze != null) * createRole(tmpMaze.firstPos); * else * createRole(new Vector3(5, 0.005f, -5)); */ //App.Game.character.rolePosCamer.test(); App.Game.character.setRoleInEscape(); StartCoroutine(escapeIEn()); } if (GUI.Button(new Rect(Screen.width - btnWidth, btnPosY * 3, btnWidth, btnHeight), "rolationCamerY")) { // App.Game.character.test(); App.Game.character.rolePosCamer.rolationCamerY(90.0f, 1.0f / 40.0f); //App.Game.character.rolePosCamer.test(0, 3.0f); } }
/// <summary> /// UI调试 /// </summary> /// <param name="obj"></param> #if DEBUG_role void OnGUI() { float btnWidth = 100.0f; float btnHeight = 100.0f; float btnPosY = btnHeight + 5.0f; GUI.Button(new Rect(0, 0, btnWidth, btnHeight), "Euipments 1"); GUI.Button(new Rect(btnWidth, 0, btnWidth, btnHeight), "Euipments 2"); GUI.Button(new Rect(btnWidth * 2, 0, btnWidth, btnHeight), "Euipments 3"); for (int i = 0; i < weapon_list.Length; i++) { if (GUI.Button(new Rect(i * btnWidth, btnPosY, btnWidth, btnHeight), "武器" + (weapon_list[i] ? "(√)" : ""))) { if (!weapon_list [i]) { for (int j = 0; j < weapon_list.Length; j++) { weapon_list [j] = false; } weapon_list [i] = true; character.ChangeWeapon("ch_we_one_hou_" + index[i]); } } } for (int i = 0; i < head_list.Length; i++) { if (GUI.Button(new Rect(i * btnWidth, btnPosY * 2, btnWidth, btnHeight), "头" + (head_list[i] ? "(√)" : ""))) { if (!head_list [i]) { for (int j = 0; j < head_list.Length; j++) { head_list [j] = false; } head_list [i] = true; character.ChangeHeadEquipment("ch_pc_hou_" + index[i] + "_tou", combine); } } } for (int i = 0; i < chest_list.Length; i++) { if (GUI.Button(new Rect(i * btnWidth, btnPosY * 3, btnWidth, btnHeight), "身体" + (chest_list[i] ? "(√)" : ""))) { if (!chest_list [i]) { for (int j = 0; j < chest_list.Length; j++) { chest_list [j] = false; } chest_list [i] = true; character.ChangeChestEquipment("ch_pc_hou_" + index[i] + "_shen", combine); } } } for (int i = 0; i < hand_list.Length; i++) { if (GUI.Button(new Rect(i * btnWidth, btnPosY * 4, btnWidth, btnHeight), "手" + (hand_list[i] ? "(√)" : ""))) { if (!hand_list [i]) { for (int j = 0; j < hand_list.Length; j++) { hand_list [j] = false; } hand_list [i] = true; character.ChangeHandEquipment("ch_pc_hou_" + index[i] + "_shou", combine); } } } for (int i = 0; i < feet_list.Length; i++) { if (GUI.Button(new Rect(i * btnWidth, btnPosY * 5, btnWidth, btnHeight), "腿" + (feet_list[i] ? "(√)" : ""))) { if (!feet_list [i]) { for (int j = 0; j < feet_list.Length; j++) { feet_list [j] = false; } feet_list [i] = true; character.ChangeFeetEquipment("ch_pc_hou_" + index[i] + "_jiao", combine); } } } }