Beispiel #1
0
        private void EndDialogue(int inGroupId)
        {
            if (this.m_curUiForm != null)
            {
                ResGuideTipInfo dataByKey = GameDataMgr.guideTipDatabin.GetDataByKey((long)inGroupId);
                DebugHelper.Assert(dataByKey != null);
                if (dataByKey != null)
                {
                    DialogueProcessor.SActorLineNode outNode = new DialogueProcessor.SActorLineNode();
                    this.TranslateNodeFromRaw(ref outNode, ref dataByKey);
                    GameObject widget = this.m_curUiForm.GetWidget(outNode.DialogPos);
                    if (widget != null)
                    {
                        widget.CustomSetActive(false);
                    }
                    this.m_currentOpenNode[outNode.DialogPos] = false;
                    bool flag = true;
                    for (int i = 0; i < this.m_currentOpenNode.Length; i++)
                    {
                        if (this.m_currentOpenNode[i])
                        {
                            flag = false;
                            break;
                        }
                    }
                    if (flag)
                    {
                        Singleton <CUIManager> .GetInstance().CloseForm(this.m_curUiForm);

                        this.m_curUiForm = null;
                    }
                }
            }
        }
Beispiel #2
0
        private void StartDialogue(int inGroupId)
        {
            ResGuideTipInfo dataByKey = GameDataMgr.guideTipDatabin.GetDataByKey((long)inGroupId);

            if (dataByKey != null)
            {
                this.TranslateNodeFromRaw(ref this.m_actorLines, ref dataByKey);
                DialogueProcessor.SActorLineNode actorLines = this.m_actorLines;
                this.QueryUiForm(actorLines.DialogStyle);
                if (this.m_curUiForm != null)
                {
                    GameObject obj2 = this.ShowOneWidget((enGuideTipFormWidget)actorLines.DialogPos, true);
                    DebugHelper.Assert(obj2 != null);
                    obj2.transform.FindChild(this.m_contentGoName).gameObject.GetComponent <Text>().text = actorLines.DialogContent;
                    obj2.transform.FindChild(this.m_nameGoName).gameObject.GetComponent <Text>().text    = actorLines.DialogTitle;
                    if (actorLines.PortraitImgPrefab.Object != null)
                    {
                        Transform transform = obj2.transform.FindChild(this.m_imgGoName);
                        if (transform != null)
                        {
                            transform.gameObject.GetComponent <Image>().SetSprite(actorLines.PortraitImgPrefab.Object);
                        }
                    }
                    if (!string.IsNullOrEmpty(actorLines.VoiceEvent))
                    {
                        Singleton <CSoundManager> .GetInstance().PostEvent(actorLines.VoiceEvent, null);
                    }
                    DebugHelper.Assert(actorLines.DialogPos < this.m_currentOpenNode.Length);
                    this.m_currentOpenNode[actorLines.DialogPos] = true;
                }
            }
        }
        public void StartDialogue(int inGroupId)
        {
            string ageActName = this.m_ageActName;

            this.EndDialogue();
            this.m_ageActName    = ageActName;
            this.m_actorLinesRaw = GameDataMgr.actorLinesDatabin.GetDataByKey(inGroupId);
            if (this.m_actorLinesRaw == null)
            {
                return;
            }
            ResActorLinesInfo dataByKeySingle = GameDataMgr.actorLinesDatabin.GetDataByKeySingle((uint)inGroupId);

            if (dataByKeySingle == null)
            {
                return;
            }
            if (CSysDynamicBlock.bDialogBlock && dataByKeySingle.bIOSHide != 0)
            {
                return;
            }
            this.m_actorLines = new DialogueProcessor.SActorLineNode[this.m_actorLinesRaw.get_Count()];
            DialogueProcessor.SActorLineNode sActorLineNode = default(DialogueProcessor.SActorLineNode);
            this.TranslateNodeFromRaw(ref sActorLineNode, ref dataByKeySingle);
            this.m_actorLines[0] = sActorLineNode;
            HashSet <object> .Enumerator enumerator = this.m_actorLinesRaw.GetEnumerator();
            if (enumerator.MoveNext())
            {
                int num = 1;
                while (enumerator.MoveNext())
                {
                    ResActorLinesInfo resActorLinesInfo = enumerator.get_Current() as ResActorLinesInfo;
                    DialogueProcessor.SActorLineNode sActorLineNode2 = default(DialogueProcessor.SActorLineNode);
                    this.TranslateNodeFromRaw(ref sActorLineNode2, ref resActorLinesInfo);
                    this.m_actorLines[num] = sActorLineNode2;
                    sActorLineNode         = sActorLineNode2;
                    num++;
                }
            }
            Singleton <CBattleGuideManager> .GetInstance().PauseGame(this, true);

            this.m_curIndex = -1;
            if (this.bAutoNextPage)
            {
                base.StartCoroutine(this.NextPageNoTimeScale());
            }
            else
            {
                this.NextPageInternal();
            }
            if (this.PreDialogId != 0 && inGroupId == this.PreDialogId)
            {
                PreDialogStartedEventParam preDialogStartedEventParam = new PreDialogStartedEventParam(this.PreDialogId);
                Singleton <GameEventSys> .get_instance().SendEvent <PreDialogStartedEventParam>(GameEventDef.Event_PreDialogStarted, ref preDialogStartedEventParam);

                this.PreDialogId = 0;
            }
        }
Beispiel #4
0
        private void TranslateNodeFromRaw(ref DialogueProcessor.SActorLineNode outNode, ref ResGuideTipInfo inRecord)
        {
            outNode.DialogContent = StringHelper.UTF8BytesToString(ref inRecord.szTipContent);
            outNode.DialogTitle   = StringHelper.UTF8BytesToString(ref inRecord.szTipTitle);
            outNode.DialogPos     = inRecord.bTipPos;
            outNode.VoiceEvent    = StringHelper.UTF8BytesToString(ref inRecord.szTipVoice);
            string text = StringHelper.UTF8BytesToString(ref inRecord.szImagePath);

            text = CUIUtility.s_Sprite_Dynamic_Dialog_Dir_Head + text;
            outNode.PortraitImgPrefab.Object = (Singleton <CResourceManager> .GetInstance().GetResource(text, typeof(GameObject), 4, false, false).m_content as GameObject);
            if (outNode.PortraitImgPrefab.Object == null)
            {
                text = CUIUtility.s_Sprite_Dynamic_Dialog_Dir_Head + "0000";
                outNode.PortraitImgPrefab.Object = (Singleton <CResourceManager> .GetInstance().GetResource(text, typeof(GameObject), 4, false, false).m_content as GameObject);
            }
        }
        private void TranslateNodeFromRaw(ref DialogueProcessor.SActorLineNode outNode, ref ResActorLinesInfo inRecord)
        {
            outNode.DialogStyle = inRecord.iDialogStyle;
            string text = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().Name;

            if (string.IsNullOrEmpty(text))
            {
                text = "Unknown";
            }
            outNode.DialogContent = StringHelper.UTF8BytesToString(ref inRecord.szDialogContent);
            if (string.IsNullOrEmpty(outNode.DialogContent))
            {
                outNode.DialogContent = string.Empty;
            }
            else
            {
                outNode.DialogContent = outNode.DialogContent.Replace("[c]", text);
            }
            outNode.DialogTitle = StringHelper.UTF8BytesToString(ref inRecord.szDialogTitle);
            if (string.IsNullOrEmpty(outNode.DialogTitle))
            {
                outNode.DialogTitle = string.Empty;
            }
            else
            {
                outNode.DialogTitle = outNode.DialogTitle.Replace("[c]", text);
            }
            outNode.bFadeIn           = (inRecord.bFadeInType > 0);
            outNode.bFadeOut          = (inRecord.bFadeOutType > 0);
            outNode.b3dPortrait       = (inRecord.iUse3dPortrait > 0);
            outNode.ActorType         = (ActorTypeDef)inRecord.iActorType;
            outNode.CharCfgId         = inRecord.iCharacterCfgId;
            outNode.AnimName          = StringHelper.UTF8BytesToString(ref inRecord.szAnimName);
            outNode.bAnimLoop         = (inRecord.iAnimLoop > 0);
            outNode.PortraitImgPrefab = default(ObjData);
            if (outNode.b3dPortrait)
            {
                if (inRecord.iCharacterCfgId > 0)
                {
                    switch (inRecord.iActorType)
                    {
                    case 0:
                        outNode.PortraitImgPath = CUICommonSystem.GetHero3DObjPath((uint)inRecord.iCharacterCfgId, true);
                        break;

                    case 1:
                        outNode.PortraitImgPath = CUICommonSystem.GetMonster3DObjPath(inRecord.iCharacterCfgId, true);
                        break;

                    case 2:
                        outNode.PortraitImgPath = CUICommonSystem.GetOrgan3DObjPath(inRecord.iCharacterCfgId, true);
                        break;
                    }
                }
            }
            else
            {
                string text2 = StringHelper.UTF8BytesToString(ref inRecord.szImagePath);
                if (text2 == "9999")
                {
                    text2 = "90" + (Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().HeadIconId + 1);
                    text2 = CUIUtility.s_Sprite_Dynamic_Dialog_Dir_Portrait + text2;
                    outNode.PortraitImgPrefab.Object = (Singleton <CResourceManager> .GetInstance().GetResource(text2, typeof(GameObject), 4, false, false).m_content as GameObject);
                }
                else
                {
                    text2 = CUIUtility.s_Sprite_Dynamic_Dialog_Dir_Portrait + text2;
                    outNode.PortraitImgPrefab.Object = (Singleton <CResourceManager> .GetInstance().GetResource(text2, typeof(GameObject), 4, false, false).m_content as GameObject);
                }
            }
        }