private void Awake() { if (npcManager == null) { npcManager = this; } }
public void openPanel(object arg) { if (panel == null) { panel = new NPCPanel(); } panel.openPanel(); Debug.Log("openPanel"); }
/* * private Button flowerButton; * private Button paintingButton; * * private Item item; */ public static NPCPanel Instance() { if (!npcPanel) { npcPanel = FindObjectOfType(typeof(NPCPanel)) as NPCPanel; if (!npcPanel) { Debug.LogError("There needs to be one active NPCPanel script on a GameObject in your Scene"); } } return(npcPanel); }
void Awake() { modalPanel = ModalPanel.Instance(); // modalPanel = FindObjectOfType(typeof(ModalPanel)) as ModalPanel; movement = Movement.Instance(); // movement = FindObjectOfType(typeof(Movement)) as Movement; npcPanel = NPCPanel.Instance(); // npcPanel2 = NPCPanel2.Instance(); myYesAction = new UnityAction(TestYesFunction); myNoAction = new UnityAction(TestNoFunction); myCancelAction = new UnityAction(TestCancelFunction); }
/// <summary> /// 显示NPC的面板 /// </summary> public void ShowguidePanel() { //设置相机位置 m_Camera.position = transform.localPosition + m_Offset + transform.forward * 1.5f; m_Camera.rotation = transform.rotation; m_Camera.Rotate(Vector3.up, m_Camera.rotation.y + 180); m_Camera.gameObject.SetActive(true); //显示面板 UIController._instance.ShowPanel(UIPanelType.NPC); //设置面板信息 NPCPanel npcPanel = UIController._instance.GetPanelByType(UIPanelType.NPC).GetComponent <BasePanel>() as NPCPanel; npcPanel.SetPanelInfo(m_Data); }
/// <summary> /// Upon changing tab we'll update the tab they selected incase data has updated! /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { switch (tabControl1.SelectedIndex) { // Item Tool case 0: ItemPanel.UpdateList(); break; // Monster Tool case 1: MonsterPanel.UpdateList(); break; // Quest Tool case 2: QuestPanel.UpdateList(); break; // Map Tool case 3: MapPanel.UpdateList(); break; // NPC Tool case 4: NPCPanel.UpdateList(); break; // GameShop Tool case 5: GameShopPanel.UpdateList(); break; // DropBuilder Tool case 6: ConquestPanel.UpdateList(); break; case 7: DropPanel.UpdateList(); break; } }
public NPCView(NPCPanel panel, Character character) { Character = character; this.panel = panel; }
/// <summary> /// The Constructor of the Tool /// </summary> public MirDataTool() { InitializeComponent(); FormClosing += MirDataTool_FormClosing; KeyDown += MirDataTool_KeyDown; #region Warn the user of mis matching data! DialogResult dialogResult = MessageBox.Show(string.Format("This tool requires all Data match if they are going to interact with one another.\r\n" + "This Means Map Info and Game Shop contents will hold incorrect values.\r\n" + "It is advised you export the data from the Server and then work on that externally." + "Do you wish to continue?"), "Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult == DialogResult.No) { Close(); } #endregion #region First time run? if (Program.firstRun) { ConfigForm form = new ConfigForm(ToolVersion); form.ShowDialog(); } #endregion #region Tool Version check if (ToolVersion > Settings.ToolVersion) { ConfigForm form = new ConfigForm(ToolVersion); form.ShowDialog(); } #endregion #region Initial File Checks if ((!File.Exists(Settings.DatabasePath + "ItemInfo.dat")) || (!File.Exists(Settings.DatabasePath + "QuestInfo.dat")) || (!File.Exists(Settings.DatabasePath + "MonsterInfo.dat")) || (!File.Exists(Settings.DatabasePath + "MapInfo.dat")) || (!File.Exists(Settings.DatabasePath + "NPCInfo.dat")) || (!File.Exists(Settings.DatabasePath + "GameShopInfo.dat")) || (!File.Exists(Settings.DatabasePath + "ConquestInfo.dat")) || (!File.Exists(Settings.DatabasePath + "CraftInfo.dat"))) { DialogResult result = MessageBox.Show(string.Format("One or more .dat files could not be found!\r\n" + "Clicking Yes will bring up the Config dialog for you to locate the .dat file(s).\r\n" + "Clicking No will allow you to create a new .dat file.\r\n" + "Clicking Cancel will close the Tool."), ".dat(s) not found!", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { ConfigForm form = new ConfigForm(ToolVersion); form.ShowDialog(); } else { #region Data file creation if (!File.Exists(Settings.DatabasePath + "ItemInfo.dat")) { using (FileStream stream = File.Create(Settings.DatabasePath + "ItemInfo.dat")) { using (BinaryWriter writer = new BinaryWriter(stream)) { writer.Write(0); } } ItemIndex = 0; } if (!File.Exists(Settings.DatabasePath + "QuestInfo.dat")) { using (FileStream stream = File.Create(Settings.DatabasePath + "QuestInfo.dat")) { using (BinaryWriter writer = new BinaryWriter(stream)) { writer.Write(0); } } QuestIndex = 0; } if (!File.Exists(Settings.DatabasePath + "MonsterInfo.dat")) { using (FileStream stream = File.Create(Settings.DatabasePath + "MonsterInfo.dat")) { using (BinaryWriter writer = new BinaryWriter(stream)) { writer.Write(0); } } MonsterIndex = 0; } if (!File.Exists(Settings.DatabasePath + "MapInfo.dat")) { using (FileStream stream = File.Create(Settings.DatabasePath + "MapInfo.dat")) { using (BinaryWriter writer = new BinaryWriter(stream)) { writer.Write(0); } } MapIndex = 0; } if (!File.Exists(Settings.DatabasePath + "NPCInfo.dat")) { using (FileStream stream = File.Create(Settings.DatabasePath + "NPCInfo.dat")) { using (BinaryWriter writer = new BinaryWriter(stream)) { writer.Write(0); } } NPCIndex = 0; } if (!File.Exists(Settings.DatabasePath + "GameShopInfo.dat")) { using (FileStream stream = File.Create(Settings.DatabasePath + "GameShopInfo.dat")) { using (BinaryWriter writer = new BinaryWriter(stream)) { writer.Write(0); } } GameShopIndex = 0; } if (!File.Exists(Settings.DatabasePath + "ConquestInfo.dat")) { using (FileStream stream = File.Create(Settings.DatabasePath + "ConquestInfo.dat")) { using (BinaryWriter writer = new BinaryWriter(stream)) { writer.Write(0); } } ConquestIndex = 0; } if (!File.Exists(Settings.DatabasePath + "CraftInfo.dat")) { using (FileStream stream = File.Create(Settings.DatabasePath + "CraftInfo.dat")) { using (BinaryWriter writer = new BinaryWriter(stream)) { writer.Write(0); } } CraftIndex = 0; } #endregion } } else { string ReadResult = ""; #region Load Data int highestIndex = 0; if (File.Exists(Settings.DatabasePath + "ItemInfo.dat")) { List <ItemInfo> temp = new List <ItemInfo>(); using (FileStream stream = File.OpenRead(Settings.DatabasePath + "ItemInfo.dat")) { using (BinaryReader reader = new BinaryReader(stream)) { int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { temp.Add(new ItemInfo(reader, Settings.DatabaseVersion, Settings.CustomDatabaseVersion)); if (temp[i].Index > highestIndex) { highestIndex = temp[i].Index; } } } } ItemIndex = highestIndex; ItemPanel.ItemInfoList = temp; ReadResult += string.Format("{0} Items loaded, Next Item Index {1}.\r\n", temp.Count, highestIndex + 1); } if (File.Exists(Settings.DatabasePath + "QuestInfo.dat")) { highestIndex = 0; List <QuestInfo> temp = new List <QuestInfo>(); using (FileStream stream = File.OpenRead(Settings.DatabasePath + "QuestInfo.dat")) { using (BinaryReader reader = new BinaryReader(stream)) { int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { temp.Add(new QuestInfo(reader)); if (temp[i].Index > highestIndex) { highestIndex = temp[i].Index; } } } } QuestIndex = highestIndex; QuestPanel.QuestInfoList = temp; ReadResult += string.Format("{0} Quests loaded, Next Quest Index {1}.\r\n", temp.Count, highestIndex + 1); } if (File.Exists(Settings.DatabasePath + "MonsterInfo.dat")) { highestIndex = 0; List <MonsterInfo> temp = new List <MonsterInfo>(); using (FileStream stream = File.OpenRead(Settings.DatabasePath + "MonsterInfo.dat")) { using (BinaryReader reader = new BinaryReader(stream)) { int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { temp.Add(new MonsterInfo(reader)); if (temp[i].Index > highestIndex) { highestIndex = temp[i].Index; } } } } MonsterIndex = highestIndex; MonsterPanel.MonsterInfoList = temp; ReadResult += string.Format("{0} Monsters loaded, Next Monster Index {1}.\r\n", temp.Count, highestIndex + 1); } if (File.Exists(Settings.DatabasePath + "MapInfo.dat")) { highestIndex = 0; List <MapInfo> temp = new List <MapInfo>(); using (FileStream stream = File.OpenRead(Settings.DatabasePath + "MapInfo.dat")) { using (BinaryReader reader = new BinaryReader(stream)) { int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { temp.Add(new MapInfo(reader)); if (temp[i].Index > highestIndex) { highestIndex = temp[i].Index; } } } } MapIndex = highestIndex; MapPanel.MapInfoList = temp; ReadResult += string.Format("{0} Maps loaded, Next Map Index {1}.\r\n", temp.Count, highestIndex + 1); } if (File.Exists(Settings.DatabasePath + "NPCInfo.dat")) { highestIndex = 0; List <NPCInfo> temp = new List <NPCInfo>(); using (FileStream stream = File.OpenRead(Settings.DatabasePath + "NPCInfo.dat")) { using (BinaryReader reader = new BinaryReader(stream)) { int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { temp.Add(new NPCInfo(reader)); if (temp[i].Index > highestIndex) { highestIndex = temp[i].Index; } } } } NPCIndex = highestIndex; NPCPanel.NPCInfoList = temp; ReadResult += string.Format("{0} NPCs loaded, Next NPC Index {1}.\r\n", temp.Count, highestIndex + 1); } if (File.Exists(Settings.DatabasePath + "GameShopInfo.dat")) { highestIndex = 0; List <GameShopItem> temp = new List <GameShopItem>(); using (FileStream stream = File.OpenRead(Settings.DatabasePath + "GameShopInfo.dat")) { using (BinaryReader reader = new BinaryReader(stream)) { int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { temp.Add(new GameShopItem(reader, true)); if (temp[i].GIndex > highestIndex) { highestIndex = temp[i].GIndex; } } } } GameShopIndex = highestIndex; GameShopPanel.GameShopInfoList = temp; ReadResult += string.Format("{0} GameShop Items loaded, Next GameShop Index {1}.\r\n", temp.Count, highestIndex + 1); } if (File.Exists(Settings.DatabasePath + "ConquestInfo.dat")) { highestIndex = 0; List <ConquestInfo> temp = new List <ConquestInfo>(); using (FileStream stream = File.OpenRead(Settings.DatabasePath + "ConquestInfo.dat")) { using (BinaryReader reader = new BinaryReader(stream)) { int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { temp.Add(new ConquestInfo(reader)); if (temp[i].Index > highestIndex) { highestIndex = temp[i].Index; } } } } ConquestIndex = highestIndex; ConquestPanel.ConquestInfos = temp; ReadResult += string.Format("{0} Conquests loaded, Next Conquest Index {1}.\r\n", temp.Count, highestIndex + 1); } if (File.Exists(Settings.DatabasePath + "CraftInfo.dat")) { highestIndex = 0; List <CraftItem> temp = new List <CraftItem>(); using (FileStream stream = File.OpenRead(Settings.DatabasePath + "CraftInfo.dat")) { using (BinaryReader reader = new BinaryReader(stream)) { int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { temp.Add(new CraftItem(reader)); if (temp[i].Recipie > (byte)highestIndex) { highestIndex = (int)temp[i].Recipie; } } } } CraftIndex = highestIndex; CraftToolPanel.CraftItems = temp; ReadResult += string.Format("{0} Crafts loaded, Next Craft Index {1}\r\n", temp.Count, highestIndex + 1); } #endregion MessageBox.Show(ReadResult); } #endregion #region Interface Update check if (itemToolPanel.ItemInfoList.Count > 0) { itemToolPanel.UpdateList(); } #endregion #region Set Child Control Parent as the MirDataTool to share functions and interact with each other. ConquestPanel.SetChild(this); DropPanel.SetChild(this); GameShopPanel.SetChild(this); ItemPanel.SetChild(this); MapPanel.SetChild(this); MonsterPanel.SetChild(this); NPCPanel.SetChild(this); QuestPanel.SetChild(this); CraftToolPanel.SetChild(this); #endregion }