Пример #1
0
        public void Init()
        {
            string    str    = "StoryDlg/StoryDlgConfig";
            TextAsset config = (TextAsset)Resources.Load(str, typeof(TextAsset));

            if (null != config)
            {
                string[] header = null;
                string[] lines  = null;
                lines = config.text.Split('\n');
                if (lines.Length > 0)
                {
                    header = lines[0].Split('\t');
                }
                for (int i = 1; i < lines.Length; ++i)
                {
                    string lineStr = lines[i];
                    if (lineStr.Trim() != String.Empty)
                    {
                        StoryDlgInfo si = BuildStoryInfo(lineStr);
                        if (si != null)
                        {
                            StoryInfos.Add(si);
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }
Пример #2
0
 private StoryDlgInfo BuildStoryInfo(string storyInfoLine)
 {
     string[] data = storyInfoLine.Split('\t');
     if (data.Length > 0)
     {
         StoryDlgInfo si = new StoryDlgInfo();
         si.ID         = Int32.Parse(data[0]);
         si.StoryName  = data[1];
         si.StoryItems = BuildStoryItems(si.StoryName);
         return(si);
     }
     else
     {
         return(null);
     }
 }
Пример #3
0
 /// Story Handlers
 public void TriggerStory(int storyId)
 {
     try
     {
         StoryDlg.StoryDlgInfo storyInfo = StoryDlg.StoryDlgManager.Instance.GetStoryInfoByID(storyId);
         if (null != storyInfo)
         {
             if (storyInfo.DlgType == StoryDlgPanel.StoryDlgType.Small)
             {
                 UIManager.Instance.ShowWindowByName("StoryDlgSmall");
                 UnityEngine.GameObject obj = UIManager.Instance.GetWindowGoByName("StoryDlgSmall");
                 if (null != obj)
                 {
                     StoryDlgPanel dlg = obj.GetComponent <StoryDlgPanel>();
                     dlg.OnTriggerStory(storyInfo);
                 }
             }
             else
             {
                 UnityEngine.GameObject obj = UIManager.Instance.GetWindowGoByName("StoryDlgBig");
                 if (null != obj)
                 {
                     StoryDlgPanel dlg = obj.GetComponent <StoryDlgPanel>();
                     dlg.OnTriggerStory(storyInfo);
                 }
             }
         }
         else
         {
             Debug.LogError("Wrong Story id = " + storyId);
         }
     }
     catch (System.Exception ex)
     {
         ArkCrossEngine.LogicSystem.LogErrorFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace);
     }
 }
Пример #4
0
        public void Init()
        {
            ArkCrossEngine.RoleInfo ri = ArkCrossEngine.LobbyClient.Instance.CurrentRole;
            if (ri != null)
            {
                Data_PlayerConfig cg = PlayerConfigProvider.Instance.GetPlayerConfigById(ri.HeroId);
                if (cg != null)
                {
                    herostr = cg.m_Portrait;
                }
                heroname = ri.Nickname;
            }
            m_StoryInfos.Clear();
            DBC dlgCfg = new DBC();

            if (dlgCfg.Load(HomePath.GetAbsolutePath(FilePathDefine_Client.C_DialogConfig)))
            {
                for (int index = 0; index < dlgCfg.RowNum; index++)
                {
                    DBC_Row node = dlgCfg.GetRowByIndex(index);
                    if (null != node)
                    {
                        StoryDlgInfo info = new StoryDlgInfo();
                        info.ID           = DBCUtil.ExtractNumeric <int>(node, "Id", 0, true);
                        info.StoryName    = DBCUtil.ExtractString(node, "StoryName", "", true);
                        info.DlgType      = (StoryDlgPanel.StoryDlgType)DBCUtil.ExtractNumeric <int>(node, "DlgType", 0, true);
                        info.IntervalTime = DBCUtil.ExtractNumeric <float>(node, "IntervalTime", 1.0f, true);
                        info.StoryItems   = BuildStoryItems(info.StoryName);
                        if (!m_StoryInfos.ContainsKey(info.ID))
                        {
                            m_StoryInfos.Add(info.ID, info);
                        }
                    }
                }
            }
        }