Exemple #1
0
    bool Talking()
    {
        if (TalkIndex >= TalkList.Count)
        {
            return(false);
        }

        string txt = TalkList[TalkIndex].second;



        NpcData   npcData = NpcData.GetData(TalkList[TalkIndex].first);
        bool      isSelf  = (npcData == null);
        ENTITY_ID assetId = npcData == null ? (ENTITY_ID)GamePlayer.Instance.GetIprop(PropertyType.PT_AssetId) : (ENTITY_ID)npcData.AssetsID;

        if (!isSelf)
        {
            if (preNpcAssId != assetId)
            {
                if (pos2 != null)
                {
                    DestroyImmediate(pos2);
                }
            }
            preNpcAssId = assetId;
        }

        bool hasGameObject = isSelf ? pos1 != null : pos2 != null;

        string actorname = isSelf? GamePlayer.Instance.InstName: npcData.Name;

        string playerName = GamePlayer.Instance.InstName;

        StringTool.RepColor(ref playerName, "00FF00");
        StringTool.RepName(ref txt, playerName);

        ClearName();
        if (pos1 != null)
        {
            pos1.SetActive(isSelf);
        }
        if (pos2 != null)
        {
            pos2.SetActive(!isSelf);
        }
        ShowName(isSelf, actorname);

        if (!hasGameObject)
        {
            GameManager.Instance.GetActorClone(assetId, isSelf ? (ENTITY_ID)GamePlayer.Instance.WeaponAssetID : (ENTITY_ID)0, EntityType.ET_Player, (GameObject go, ParamData data) =>
            {
                if (hasDestroy_)
                {
                    Destroy(go);
                    return;
                }

                int dialogScale = 0;
                GlobalValue.Get(Constant.C_DialogScale, out dialogScale);
                if (data.bParam == true)
                {
                    pos1 = go;
                    pos1.transform.parent        = model[0];
                    pos1.transform.localPosition = /*ector3.zero*/ new Vector3(0f, 0f, -200f);
                    pos1.transform.Rotate(Vector3.up, 180f);
                    float zoom = EntityAssetsData.GetData((int)assetId).zoom_;
                    pos1.transform.localScale = new Vector3(zoom + dialogScale, zoom + dialogScale, zoom + dialogScale);
                }
                else
                {
                    pos2 = go;
                    pos2.transform.parent        = model[1];
                    pos2.transform.localPosition = /*Vector3.zero*/ new Vector3(0f, 0f, -200f);
                    pos2.transform.Rotate(Vector3.up, 180f);
                    float zoom = EntityAssetsData.GetData((int)assetId).zoom_;
                    pos2.transform.localScale = new Vector3(zoom + dialogScale, zoom + dialogScale, zoom + dialogScale);
                }

                //PlayerAsseMgr.DeleteAsset(assetId, false);
            }, new ParamData((int)assetId, isSelf), "UI", isSelf ? GamePlayer.Instance.DressID : 0);
        }

        NpcDialogue = txt;
        TalkIndex++;
        return(true);
    }