Beispiel #1
0
 void PlayerEndAudio()
 {
     if (null == m_CurSelNpc)
     {
         return;
     }
     if (m_CurSelNpc.proto == EEntityProto.Npc)
     {
         NpcProtoDb.Item proto = NpcProtoDb.Get(m_CurSelNpc.ProtoID);
         if (null != proto && null != proto.chart2 && proto.chart2.Length > 0)
         {
             AudioManager.instance.Create(m_CurSelNpc.position + 1.8f * Vector3.up, proto.chart2[Random.Range(0, proto.chart2.Length)], m_CurSelNpc.tr);
         }
     }
 }
    void OnSetGoalItemContent(UIMissionGoalItem item)
    {
        MissionGoal mg = _goals[item.index];

        if (!mg.achieved)
        {
            item.textColor = Color.white;
        }
        else
        {
            item.textColor = Color.green;
        }

        if (mg as MissionGoal_Bool != null)
        {
            MissionGoal_Bool mgb = mg as MissionGoal_Bool;
            item.SetBoolContent(mgb.text, mgb.achieved);
        }
        else if (mg as MissionGoal_Item != null)
        {
            MissionGoal_Item mgi  = mg as MissionGoal_Item;
            string           text = mgi.text + " " + mgi.current.ToString() + "/" + mgi.target.ToString();

            item.value0 = mgi.current;
            item.value1 = mgi.target;

            if (mgi.item.isSpecificPrototype)
            {
                string[] sprites = ItemAsset.ItemProto.GetIconName(mgi.item.Id);
                if (sprites != null)
                {
                    item.SetItemContent(text, sprites[0]);
                }
                else
                {
                    item.SetItemContent(text);
                }
            }
            else
            {
                item.SetItemContent(text);
            }
        }
        else if (mg as MissionGoal_Kill != null)
        {
            MissionGoal_Kill mgk = mg as MissionGoal_Kill;

            string           text = mgk.text + " " + mgk.current.ToString() + "/" + mgk.target.ToString();
            MissionGoal_Kill mgi  = mg as MissionGoal_Kill;

            item.value0 = mgi.current;
            item.value1 = mgi.target;

            if (item != null)
            {
                if (mgi.monster.isSpecificEntity)
                {
                    SpawnPoint sp = PeCustomScene.Self.spawnData.GetSpawnPoint(mgi.id);
                    if (sp as MonsterSpawnPoint != null)
                    {
                        MonsterProtoDb.Item proto = MonsterProtoDb.Get(sp.ID);
                        item.SetItemContent(text, proto.icon);
                    }
                    else if (sp as NPCSpawnPoint != null)
                    {
                        NpcProtoDb.Item proto = NpcProtoDb.Get(sp.ID);
                        item.SetItemContent(text, proto.icon);
                    }
                    else
                    {
                        item.SetItemContent(text);
                    }
                }
                else if (mgi.monster.isSpecificPrototype)
                {
                    MonsterProtoDb.Item proto = MonsterProtoDb.Get(mgi.monster.Id);
                    if (proto != null)
                    {
                        item.SetItemContent(text, proto.icon);
                    }
                    else
                    {
                        item.SetItemContent(text);
                    }
                }
                else
                {
                    item.SetItemContent(text);
                }
            }
            else
            {
                item.SetItemContent(text);
            }
        }
    }
        public virtual void Deserialize(BinaryReader r)
        {
            if (!m_Init)
            {
                InitSkEntity();
            }
            int readVersion = r.ReadInt32();

            if (readVersion == 2)
            {
                _attribs.DisableNumAttribsEvent();
                for (int i = 0; i < (int)AttribType.HPRecover; i++)
                {
                    _attribs.sums[i] = _attribs.raws[i] = r.ReadSingle();
                }
                _attribs.EnableNumAttribsEvent();

                SetAttribute(AttribType.HPRecover, 0.01f);
            }
            else
            {
                _attribs.Deserialize(r);
            }

            if (1 == readVersion)
            {
                int buffLength = r.ReadInt32();
                m_InitBuffList = new int[buffLength];
                for (int i = 0; i < buffLength; i++)
                {
                    m_InitBuffList[i] = r.ReadInt32();
                }
            }

            EntityProto entityProto = Entity.entityProto;

            if (null != entityProto)
            {
                switch (entityProto.proto)
                {
                case EEntityProto.Monster:
                    MonsterProtoDb.Item monsterPDB = MonsterProtoDb.Get(entityProto.protoId);
                    if (null != monsterPDB)
                    {
                        m_InitBuffList = monsterPDB.initBuff;
                    }
                    break;

                case EEntityProto.Npc:
                    NpcProtoDb.Item npcPDB = NpcProtoDb.Get(entityProto.protoId);
                    if (null != npcPDB)
                    {
                        m_InitBuffList = npcPDB.InFeildBuff;
                    }
                    break;

                case EEntityProto.Player:
                    PlayerProtoDb.Item playerPDB = PlayerProtoDb.Get();
                    if (null != playerPDB)
                    {
                        m_InitBuffList = playerPDB.initBuff;
                    }
                    break;

                case EEntityProto.RandomNpc:
                    PlayerProtoDb.Item RnpcPDB = PlayerProtoDb.GetRandomNpc();
                    if (null != RnpcPDB)
                    {
                        m_InitBuffList = RnpcPDB.InFeildBuff;
                    }
                    break;
                }
            }
        }
    void OnMissionNodeClick(int type, UIMissionGoalNode node)
    {
        RefreshNodeSelected();

        DetachGoalEvent();

        MissionProperty mp = null;

        if (type == 0)
        {
            mp            = PeCustomScene.Self.scenario.missionMgr.GetMissionProperty(m_MainStoryIds[node.index]);
            _currentGoals = PeCustomScene.Self.scenario.missionMgr.GetGoals(m_MainStoryIds[node.index]);
            if (_currentGoals != null)
            {
                _goals = _currentGoals.Values;
            }

            _currentMissionId = m_MainStoryIds[node.index];
        }
        else if (type == 1)
        {
            mp            = PeCustomScene.Self.scenario.missionMgr.GetMissionProperty(m_SideQuestIdes[node.index]);
            _currentGoals = PeCustomScene.Self.scenario.missionMgr.GetGoals(m_SideQuestIdes[node.index]);
            if (_currentGoals != null)
            {
                _goals = _currentGoals.Values;
            }

            _currentMissionId = m_SideQuestIdes[node.index];
        }
        else
        {
            _currentMissionId = -1;
            _currentGoals     = null;
            _goals            = null;

            _rewardItemIds   = null;
            _rewardItemCount = null;
        }

        if (mp != null)
        {
            // Begin Npc
            if (CustomGameData.Mgr.Instance != null &&
                CustomGameData.Mgr.Instance.curGameData.WorldIndex == mp.beginNpcWorldIndex)
            {
                SpawnPoint sp = PeCustomScene.Self.spawnData.GetSpawnPoint(mp.beginNpcId);
                if (sp as NPCSpawnPoint != null)
                {
                    NpcProtoDb.Item proto = NpcProtoDb.Get(sp.Prototype);
                    missionWnd.SetMissionAbout(sp.Name, proto.iconBig, mp.objective);
                }
                else if (sp as MonsterSpawnPoint != null)
                {
                    MonsterProtoDb.Item proto_mst = MonsterProtoDb.Get(sp.Prototype);
                    missionWnd.SetMissionAbout(sp.Name, proto_mst.icon, mp.objective);
                }
                else
                {
                    missionWnd.SetMissionAbout("None", "npc_big_Unknown", mp.objective);
                    //Debug.LogWarning("The Npc Id [" + mp.beginNpcId.ToString() + "] spawn point is not exist");
                }
            }
            else
            {
                missionWnd.SetMissionAbout("None", "npc_big_Unknown", mp.objective);
            }

            // End Npc
            if (CustomGameData.Mgr.Instance != null &&
                CustomGameData.Mgr.Instance.curGameData.WorldIndex == mp.endNpcWorldIndex)
            {
                SpawnPoint sp = PeCustomScene.Self.spawnData.GetSpawnPoint(mp.endNpcId);
                if (sp as NPCSpawnPoint != null)
                {
                    NpcProtoDb.Item proto = NpcProtoDb.Get(sp.Prototype);
                    missionWnd.SetRewardInfo(sp.Name, proto.iconBig);
                }
                else if (sp as MonsterSpawnPoint != null)
                {
                    MonsterProtoDb.Item proto_mst = MonsterProtoDb.Get(sp.Prototype);
                    missionWnd.SetRewardInfo(sp.Name, proto_mst.icon);
                }
                else
                {
                    missionWnd.SetRewardInfo("None", "npc_big_Unknown");
                    Debug.LogWarning("The Npc Id [" + mp.endNpcId.ToString() + "] spawn point is not exist");
                }
            }
            else
            {
                missionWnd.SetRewardInfo("None", "npc_big_Unknown");
            }

            // Reward
            if (mp.rewardDesc != null)
            {
                missionWnd.SetRewardDesc(mp.rewardDesc);
            }
            else
            {
                _rewardItemIds   = mp.rewardItemIds;
                _rewardItemCount = mp.rewardItemCount;
                missionWnd.UpdateRewardItem(mp.rewardItemIds.Count);
            }
        }

        // goal
        if (_currentGoals != null)
        {
            AttachGoalEvent();
            missionWnd.UpdateGoalItem(_currentGoals.Count);
        }
    }