using UnityEditor; using UnityEngine; using System.Collections; using System.Collections.Generic; public class GameTools : EditorWindow { private string addCraftId = "1"; private string addCraftX = "64"; private string addCraftY = "56"; private string selfHurt = "300"; private string testDevice = ""; private string clanId = "0"; private string msg = ""; private string replayFile = ""; // Add menu item named "My Window" to the Window menu [MenuItem("BattleArray/Game Tools")] public static void ShowWindow() { //Show existing window instance. If one doesn't exist, make one. EditorWindow.GetWindow(typeof(GameTools)); } void OnGUI() { if(GUILayout.Button("Delete All PlayerPrefs")) { LocalSaver.GetInstance().DeleteAll(); } GUILayout.Label("Test device"); testDevice = GUILayout.TextField(testDevice); if(GUILayout.Button("Login with test device")) { Session.GetInstance ().myUserData.deviceId = testDevice; Session.GetInstance ().GetNetworkManager ().Login (null); } GUILayout.Label("Show tools"); GUILayout.BeginHorizontal(); if(GUILayout.Button("Self Hurt, Range(6)")) { if(Application.isPlaying) { BattleSession battleSession = Session.GetInstance().GetBattleSession(); Craft craft = battleSession.GetBattleController().GetCtrlCraft(); if(craft != null) { List list = battleSession.GetBattleController().GetMap().GetBattleObjectByRange(craft.position, 6f, craft.team); for(int i=0; i(); CraftSelectionPanel craftSelectPanel = GameObject.FindObjectOfType(); if(craftSelectPanel != null) craftSelectPanel.Close(); } } GUILayout.Label("ID:", GUILayout.Width(25)); addCraftId = GUILayout.TextField(addCraftId); GUILayout.EndHorizontal(); if (Application.isPlaying) { if (GUILayout.Button ("Battle Win")) { Session.GetInstance ().GetBattleSession ().myPlayer.coinSpend = Random.Range(100, 150); Session.GetInstance ().GetBattleSession ().GetBattleController().GameOver(TeamUtil.Team.Blue); } if (GUILayout.Button ("Battle lose")) { Session.GetInstance ().GetBattleSession ().myPlayer.coinSpend = Random.Range(100, 150); Session.GetInstance ().GetBattleSession ().GetBattleController().GameOver(TeamUtil.Team.Red); } if (GUILayout.Button ("Battle draw")) { Session.GetInstance ().GetBattleSession ().myPlayer.coinSpend = Random.Range(100, 150); Session.GetInstance ().GetBattleSession ().GetBattleController().GameOver(TeamUtil.Team.Yellow); } } if (Application.isPlaying) { if (GUILayout.Button ("Create clan")) { ClanRequest.Create ("Fenix", "My first clan, wa ha ha.", ClanData.Limit.Anyone); } } if(GUILayout.Button("WWW.EscapeURL")) { Debug.Log (WWW.EscapeURL(msg)); Debug.Log (StringUtil.LimitInput(msg, 6)); } replayFile = EditorGUILayout.TextField(replayFile); // if(GUILayout.Button("Load Replay")) // { // ReplayManager.GetInstance ().Load (replayFile); // } // if(GUILayout.Button("Share Replay")) // { // ChatRequest.Replay ("my first replay", replayFile); // } if (GUILayout.Button ("Battle Win")) { ResultPanel.Show (new ResultPanel.ResultData(null, null, ResultPanel.Result.Win, Random.Range(10, 100))); } if (GUILayout.Button ("Battle Lose")) { ResultPanel.Show (new ResultPanel.ResultData(null, null, ResultPanel.Result.Lose, Random.Range(10, 100))); } if (GUILayout.Button ("Battle Draw")) { ResultPanel.Show (new ResultPanel.ResultData(null, null, ResultPanel.Result.Draw, Random.Range(10, 100))); } } }