脚本功能设定:游戏GM工具(根据物品ID、数量向服务器发送信息,获取本地所需物品道具)
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.Collections.Generic;
using System.Linq;
using Tianyu;
public class GMUtil : EditorWindow
{
string[] toolbarStr = new string[] { "标准添加道具", "搜索添加道具" };//标题栏名称
int toolbarOption = 0;//默认显示也签ID
List<ItemNodeState> allItemNodeList;
List<HeroNode> allHeroNodeList;
bool isAddedListener = false;
bool isRemovedListener = false;
//注册消息监听
private void OnEnable()
{
MessageMediator.AddListener<CReadPacket>(MessageMediatType.gm_add_player_data_ret, ReceiveServGMMsg);
}
//销毁消息监听
private void OnDisable()
{
MessageMediator.RemoveListener<CReadPacket>(MessageMediatType.gm_add_player_data_ret, ReceiveServGMMsg);
}
//Window面板绘制
static GMUtil window;
[MenuItem("Tools/GM工具 #&Q")]
static void Main()
{
window = (GMUtil)EditorWindow.GetWindow(typeof(GMUtil), false, "GM工具");
window.Show();
}
private void OnGUI()
{
if(!Application.isPlaying || SceneManage.Instance.SceneID != EnumSceneID.UI_MajorCity01)
{
GUILayout.Label("请进入主城后再使用GM工具");
return;
}
else
{
//初始化获取所有物品表信息
if (isAddedListener == false)
{
isAddedListener = true;
}
if (allItemNodeLis