Ejemplo n.º 1
0
        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);
                }
            }
        }