public void Init() { m_NpcInfos.Clear(); DBC dlgCfg = new DBC(); if (dlgCfg.Load(HomePath.GetAbsolutePath(FilePathDefine_Client.C_ClickNpc))) { for (int index = 0; index < dlgCfg.RowNum; index++) { DBC_Row node = dlgCfg.GetRowByIndex(index); if (null != node) { ClickNpcInfo info = new ClickNpcInfo(); info.LinkId = DBCUtil.ExtractNumeric <int>(node, "LinkId", 0, true); info.StoryId = DBCUtil.ExtractNumeric <int>(node, "StoryId", 0, false); info.UIName = DBCUtil.ExtractString(node, "UIName", "", false); info.Currency = DBCUtil.ExtractNumeric <int>(node, "Currency", 0, true); info.CurrencySprite = DBCUtil.ExtractString(node, "CurrencySprite", "", false); if (!m_NpcInfos.ContainsKey(info.LinkId)) { m_NpcInfos.Add(info.LinkId, info); } } } } }
private void OnStoryEnd(int storyId) { if (m_LastTriggerNpcLinkId > 0) { ClickNpcInfo click_npc = null; if (m_NpcInfos.TryGetValue(m_LastTriggerNpcLinkId, out click_npc)) { UIManager.Instance.SetAllUiVisible(true); string ui_name = click_npc.UIName; if (ui_name.Length > 0) { UIManager.Instance.ShowWindowByName(ui_name); } } } m_LastTriggerNpcLinkId = 0; }
private void TriggerLogic(int link_id) { ClickNpcInfo click_npc = null; if (m_NpcInfos.TryGetValue(link_id, out click_npc)) { int story_id = click_npc.StoryId; string ui_name = click_npc.UIName; int currency = click_npc.Currency; string currencysprite = click_npc.CurrencySprite; if (story_id > 0) { UnityEngine.GameObject go = UnityEngine.GameObject.Find(ArkCrossEngine.GlobalVariables.cGameRootName); if (go != null) { GameLogic game_logic = go.GetComponent <GameLogic>(); if (game_logic != null) { UIManager.Instance.SetAllUiVisible(false); m_LastTriggerNpcLinkId = link_id; game_logic.TriggerStory(story_id); } } } else if (ui_name.Length > 0) { if (currency != 0) { UnityEngine.GameObject go = UIManager.Instance.GetWindowGoByName(ui_name); if (go != null) { Store store = go.GetComponent <Store>(); if (store != null) { store.ChangeStore(currency, currencysprite); } } } UIManager.Instance.ShowWindowByName(ui_name); } } }