Exemple #1
0
    public bool MarqueeHandle(CReadPacket packet)
    {
        Debug.Log("MarqueeHandle 跑马灯");
        Dictionary <string, object> data = packet.data;

        int resolt = int.Parse(data["ret"].ToString());

        if (resolt == 0)
        {
            if (null != data)
            {
                if (int.Parse(data["opt2"].ToString()) == 2)//1:跑马灯 2 :任务 3:播放任务接收成功特效4,悬赏
                {
                    Debug.Log("类型" + int.Parse(data["opt2"].ToString()) + "___" + "任务id" + int.Parse(data["opt3"].ToString()));


                    TaskDataNode taskDataNode = FSDataNodeTable <TaskDataNode> .GetSingleton().FindDataByType(int.Parse(data["opt3"].ToString()));

                    if (taskDataNode != null)
                    {
                        if (taskDataNode.Requiretype == 9)
                        {
                            Debug.Log("展示使用道具面板");
                            //UITaskUseItemPanel.Instance.SetTaskID(int.Parse(data["opt3"].ToString()), TaskClass.Main);
                            //Control.ShowGUI(GameLibrary.UITaskUseItemPanel);
                            object[] tempObj = new object[] { long.Parse(data["opt3"].ToString()), TaskClass.Main };
                            Control.ShowGUI(UIPanleID.UITaskUseItemPanel, EnumOpenUIType.DefaultUIOrSecond, false, tempObj);
                        }
                        else if (taskDataNode.Requiretype == 3)
                        {
                            if (TaskManager.Single().TaskToCaijiDic.ContainsKey(int.Parse(data["opt3"].ToString())))
                            {
                                //long collectID = TaskManager.Single().TaskToCaijiDic[int.Parse(data["opt3"].ToString())].opt4;
                                long collectID = long.Parse(data["user1"].ToString());
                                if (TaskManager.Single().TaskItemCountsDic.ContainsKey(collectID))
                                {
                                    TaskManager.Single().TaskItemCountsDic[collectID] = TaskManager.Single().TaskItemCountsDic[collectID] + 1;
                                }
                                else
                                {
                                    TaskManager.Single().TaskItemCountsDic.Add(collectID, 1);
                                }
                            }
                        }
                        else if (taskDataNode.Requiretype == 6)
                        {
                            if (TaskManager.Single().TaskToSkillMonsterDic.ContainsKey(int.Parse(data["opt3"].ToString())))
                            {
                                long monsterId1 = TaskManager.Single().TaskToSkillMonsterDic[int.Parse(data["opt3"].ToString())].opt4;
                                long monsterId2 = TaskManager.Single().TaskToSkillMonsterDic[int.Parse(data["opt3"].ToString())].opt6;
                                if (int.Parse(data["user1"].ToString()) == monsterId1)
                                {
                                    if (TaskManager.Single().TaskSkillMonsterCountsDic.ContainsKey(monsterId1))
                                    {
                                        //如果杀怪数量满足 不再增加
                                        if (TaskManager.Single().TaskSkillMonsterCountsDic[monsterId1] < TaskManager.Single().TaskToSkillMonsterDic[int.Parse(data["opt3"].ToString())].opt5)
                                        {
                                            TaskManager.Single().TaskSkillMonsterCountsDic[monsterId1] = TaskManager.Single().TaskSkillMonsterCountsDic[monsterId1] + 1;
                                        }
                                    }
                                    else
                                    {
                                        TaskManager.Single().TaskSkillMonsterCountsDic.Add(monsterId1, 1);
                                    }
                                }
                                if (int.Parse(data["user1"].ToString()) == monsterId2)
                                {
                                    if (TaskManager.Single().TaskSkillMonsterCountsDic.ContainsKey(monsterId2))
                                    {
                                        //如果杀怪数量满足 不再增加
                                        if (TaskManager.Single().TaskSkillMonsterCountsDic[monsterId2] < TaskManager.Single().TaskToSkillMonsterDic[int.Parse(data["opt3"].ToString())].opt7)
                                        {
                                            TaskManager.Single().TaskSkillMonsterCountsDic[monsterId2] = TaskManager.Single().TaskSkillMonsterCountsDic[monsterId2] + 1;
                                        }
                                    }
                                    else
                                    {
                                        TaskManager.Single().TaskSkillMonsterCountsDic.Add(monsterId2, 1);
                                    }
                                }
                            }
                        }
                        else if (taskDataNode.Requiretype == 7)
                        {
                            if (TaskManager.Single().TaskToSMGoodsDic.ContainsKey(int.Parse(data["opt3"].ToString())))
                            {
                                long itemId1 = TaskManager.Single().TaskToSMGoodsDic[int.Parse(data["opt3"].ToString())].opt4;
                                long itemId2 = TaskManager.Single().TaskToSMGoodsDic[int.Parse(data["opt3"].ToString())].opt6;
                                if (int.Parse(data["user1"].ToString()) == itemId1)
                                {
                                    if (TaskManager.Single().TaskSMGoodsCountDic.ContainsKey(itemId1))
                                    {
                                        //掉落物数量满足 不再增加
                                        if (TaskManager.Single().TaskSMGoodsCountDic[itemId1] < TaskManager.Single().TaskToSMGoodsDic[int.Parse(data["opt3"].ToString())].opt5)
                                        {
                                            TaskManager.Single().TaskSMGoodsCountDic[itemId1] = TaskManager.Single().TaskSMGoodsCountDic[itemId1] + 1;
                                        }
                                    }
                                    else
                                    {
                                        TaskManager.Single().TaskSMGoodsCountDic.Add(itemId1, 1);
                                    }
                                }
                                if (int.Parse(data["user1"].ToString()) == itemId2)
                                {
                                    if (TaskManager.Single().TaskSMGoodsCountDic.ContainsKey(itemId2))
                                    {
                                        //掉落物数量满足 不再增加
                                        if (TaskManager.Single().TaskSMGoodsCountDic[itemId2] < TaskManager.Single().TaskToSMGoodsDic[int.Parse(data["opt3"].ToString())].opt7)
                                        {
                                            TaskManager.Single().TaskSMGoodsCountDic[itemId2] = TaskManager.Single().TaskSMGoodsCountDic[itemId2] + 1;
                                        }
                                    }
                                    else
                                    {
                                        TaskManager.Single().TaskSMGoodsCountDic.Add(itemId2, 1);
                                    }
                                }
                            }
                        }
                        //Control.ShowGUI(GameLibrary.UITaskTracker);
                    }

                    //if (int.Parse(data["opt3"].ToString()) ==507 )
                    //{

                    //    //if (TaskManager.NpcTaskListDic.ContainsKey(102))
                    //    //{
                    //    //    int taskID = 0;
                    //    //    foreach (int key in TaskManager.NpcTaskListDic[102].Keys)
                    //    //    {
                    //    //        taskID = key;
                    //    //    }
                    //    //    ClientSendDataMgr.GetSingle().GetTaskSend().ClickNpc(102, taskID, TaskManager.NpcTaskListDic[102][taskID].parm0);
                    //    //}


                    //    //ClientSendDataMgr.GetSingle().GetTaskSend().ClickNpc(102, 507, TaskManager.NpcTaskListDic[102][507].parm0);
                    //}
                }
                else if (int.Parse(data["opt2"].ToString()) == 3)
                {
                    //TaskEffectManager.instance.ShowTaskEffect(TaskEffectType.AcceptTask);
                    UITaskEffectPanel.instance.ShowTaskEffect(TaskEffectType.AcceptTask);
                    UIDialogue.instance.ShowTaskHidePanel();
                }
                if (int.Parse(data["opt2"].ToString()) == 4)
                {
                    // Singleton<SceneManage>.Instance.MessageHandle(EnumSceneID.UI_MajorCity01,GameLibrary.UITaskTracker, EnumSceneID.LGhuangyuan);
                    // UITaskTracker.instance.GetRewardData();
                }
                if (int.Parse(data["opt2"].ToString()) == 1)
                {
                    MarqueeData marqueeData = new MarqueeData();
                    marqueeData.opt1 = int.Parse(data["opt1"].ToString());
                    marqueeData.opt2 = int.Parse(data["opt2"].ToString());
                    marqueeData.opt3 = int.Parse(data["opt3"].ToString());

                    marqueeData.user1 = data["user1"].ToString();
                    marqueeData.user2 = data["user2"].ToString();
                    marqueeData.user3 = data["user3"].ToString();

                    if (!playerData.GetInstance().marqueeListDic.ContainsKey(marqueeData.opt3))
                    {
                        List <MarqueeData> list = new List <MarqueeData>();
                        list.Add(marqueeData);
                        playerData.GetInstance().marqueeListDic.Add(marqueeData.opt3, list);
                    }
                    else
                    {
                        //  List<MarqueeData> list = null;
                        // list.Add(marqueeData);
                        // playerData.GetInstance().marqueeListDic.TryGetValue(marqueeData.opt3, out list);//out从字典里取出来
                        // list.Add(marqueeData);
                        playerData.GetInstance().marqueeListDic[marqueeData.opt3].Add(marqueeData);
                    }
                    if (Singleton <SceneManage> .Instance.Current == EnumSceneID.UI_MajorCity01 || Singleton <SceneManage> .Instance.Current == EnumSceneID.LGhuangyuan)
                    {
                        Control.ShowGUI(UIPanleID.UIMarquee, EnumOpenUIType.DefaultUIOrSecond);
                    }
                }
            }
            return(true);
        }
        else
        {
            //   Debug.Log(string.Format("返回信息失败:{0}", data["desc"].ToString()));
            Debug.Log("跑马灯返回消息失败");
            return(false);
        }
    }
Exemple #2
0
    void SetTaskTrackerShow()
    {
        taskDataList.Clear();

        //for (int i = taskDataList.Count - 1; i >= 0; i--)
        //{
        //    if (taskDataList[i].taskItem.taskindex<=9)
        //    {
        //        taskDataList .RemoveAt(i);
        //    }
        //}

        List <TaskItem> TaskItemList = TaskManager.Single().GetStateTaskList();

        for (int i = 0; i < TaskItemList.Count; i++)
        {
            TaskData taskData = new TaskData();
            taskItem          = TaskItemList[i];
            taskData.taskItem = taskItem;
            TaskDataNode taskDataNode = FSDataNodeTable <TaskDataNode> .GetSingleton().FindDataByType(taskItem.missionid);

            if (taskDataNode != null)
            {
                taskData.title = GetTaskTypeString(taskDataNode.Type) + taskItem.tasknode.Taskname;
                if (taskDataNode.Requiretype == 3)//采集数量显示
                {
                    long collectID1 = 0;
                    long collectID2 = 0;
                    if (TaskManager.Single().TaskToCaijiDic.ContainsKey(taskItem.missionid))
                    {
                        collectID1 = TaskManager.Single().TaskToCaijiDic[taskItem.missionid].opt4;
                        collectID2 = TaskManager.Single().TaskToCaijiDic[taskItem.missionid].opt6;
                        //if (TaskManager.Single().TaskItemCountsDic.ContainsKey(collectID))
                        //{
                        //    if (TaskManager.Single().TaskItemCountsDic[collectID] < TaskManager.Single().TaskToCaijiDic[_taskItem.missionid].opt5)
                        //    {
                        //        caijiCount = TaskManager.Single().TaskItemCountsDic[collectID];
                        //    }
                        //    else
                        //    {
                        //        caijiCount = (int)TaskManager.Single().TaskToCaijiDic[_taskItem.missionid].opt5;
                        //    }
                        //}
                        //else
                        //{
                        //    caijiCount = 0;
                        //}
                    }
                    else//后端给我的信息是在 接收任务之后。这就导致未接的时候找不到ID,没法替换追踪显示中的数量。这时候我自己去读表
                    {
                        if (taskDataNode.Opt5.Length > 0)
                        {
                            long trackingIndex = taskDataNode.Opt5[0];
                            if (FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList.ContainsKey(trackingIndex))
                            {
                                collectID1 = FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[trackingIndex].collectid[0, 0];
                            }
                        }
                        if (taskDataNode.Opt5.Length > 1)
                        {
                            long trackingIndex = taskDataNode.Opt5[1];
                            if (FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList.ContainsKey(trackingIndex))
                            {
                                collectID2 = FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[trackingIndex].collectid[0, 0];
                            }
                        }
                    }
                    taskData.content = taskItem.tasknode.Require.Replace("c1", GameLibrary.C1)
                                       .Replace("c2", GameLibrary.C2)
                                       .Replace("c3", GameLibrary.C3)
                                       .Replace("c4", GameLibrary.C4)
                                       .Replace("c5", GameLibrary.C5)
                                       .Replace("c6", GameLibrary.C6)
                                       .Replace("%d" + collectID1, GetTaskGoodsCount(taskDataNode.Requiretype, collectID1, taskItem).ToString())
                                       .Replace("%d" + collectID2, GetTaskGoodsCount(taskDataNode.Requiretype, collectID2, taskItem).ToString());
                }
                else if (taskDataNode.Requiretype == 6)//杀怪数量显示
                {
                    long monsterId1 = 0;
                    long monsterId2 = 0;
                    if (TaskManager.Single().TaskToSkillMonsterDic.ContainsKey(taskItem.missionid))
                    {
                        //暂时杀怪是两种 最多三种
                        monsterId1 = TaskManager.Single().TaskToSkillMonsterDic[taskItem.missionid].opt4;
                        monsterId2 = TaskManager.Single().TaskToSkillMonsterDic[taskItem.missionid].opt6;
                        //if (TaskManager.Single().TaskSkillMonsterCountsDic.ContainsKey(monsterId1))
                        //{
                        //    if (TaskManager.Single().TaskSkillMonsterCountsDic[monsterId1] < TaskManager.Single().TaskToSkillMonsterDic[_taskItem.missionid].opt5)
                        //    {
                        //        monster1Count = TaskManager.Single().TaskSkillMonsterCountsDic[monsterId1];
                        //    }
                        //    else
                        //    {
                        //        monster1Count = (int)TaskManager.Single().TaskToSkillMonsterDic[_taskItem.missionid].opt5;
                        //    }
                        //}
                        //if (TaskManager.Single().TaskSkillMonsterCountsDic.ContainsKey(monsterId2))
                        //{
                        //    if (TaskManager.Single().TaskSkillMonsterCountsDic[monsterId2] < TaskManager.Single().TaskToSkillMonsterDic[_taskItem.missionid].opt7)
                        //    {
                        //        monster2Count = TaskManager.Single().TaskSkillMonsterCountsDic[monsterId2];
                        //    }
                        //    else
                        //    {
                        //        monster2Count = (int)TaskManager.Single().TaskToSkillMonsterDic[_taskItem.missionid].opt7;
                        //    }
                        //}
                    }
                    else
                    {
                        Dictionary <long, int> idAndcountDic = taskDataNode.IdAndcountDic;
                        List <long>            idArr         = new List <long>();
                        foreach (long id in idAndcountDic.Keys)
                        {
                            idArr.Add(id);
                        }
                        if (idArr.Count >= 2)
                        {
                            monsterId1 = idArr[0];
                            monsterId2 = idArr[1];
                        }
                        else if (idArr.Count == 1)
                        {
                            monsterId1 = idArr[0];
                        }
                    }
                    taskData.content = taskItem.tasknode.Require.Replace("c1", GameLibrary.C1)
                                       .Replace("c2", GameLibrary.C2)
                                       .Replace("c3", GameLibrary.C3)
                                       .Replace("c4", GameLibrary.C4)
                                       .Replace("c5", GameLibrary.C5)
                                       .Replace("c6", GameLibrary.C6)
                                       .Replace("%d" + monsterId1, GetTaskGoodsCount(taskDataNode.Requiretype, monsterId1, taskItem).ToString())
                                       .Replace("%d" + monsterId2, GetTaskGoodsCount(taskDataNode.Requiretype, monsterId2, taskItem).ToString());
                }
                else if (taskDataNode.Requiretype == 7)//杀怪掉落物显示
                {
                    long itemId1 = 0;
                    long itemId2 = 0;
                    if (TaskManager.Single().TaskToSMGoodsDic.ContainsKey(taskItem.missionid))
                    {
                        itemId1 = TaskManager.Single().TaskToSMGoodsDic[taskItem.missionid].opt4;
                        itemId2 = TaskManager.Single().TaskToSMGoodsDic[taskItem.missionid].opt6;
                    }
                    else
                    {
                        long trackingIndex = taskDataNode.Opt2;
                        if (FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList.ContainsKey(trackingIndex))
                        {
                            if (FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[trackingIndex].collectid.GetLength(0) >= 2)
                            {
                                itemId1 = FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[trackingIndex].collectid[0, 0];

                                itemId2 = FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[trackingIndex].collectid[1, 0];
                            }
                            else if (FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[trackingIndex].collectid.GetLength(0) == 1)
                            {
                                itemId1 = FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[trackingIndex].collectid[0, 0];
                            }
                        }
                    }
                    taskData.content = taskItem.tasknode.Require.Replace("c1", GameLibrary.C1)
                                       .Replace("c2", GameLibrary.C2)
                                       .Replace("c3", GameLibrary.C3)
                                       .Replace("c4", GameLibrary.C4)
                                       .Replace("c5", GameLibrary.C5)
                                       .Replace("c6", GameLibrary.C6)
                                       .Replace("%d" + itemId1, GetTaskGoodsCount(taskDataNode.Requiretype, itemId1, taskItem).ToString())
                                       .Replace("%d" + itemId2, GetTaskGoodsCount(taskDataNode.Requiretype, itemId2, taskItem).ToString());


                    //long smonsterId1 = 0;
                    //long itemId = 0;//任务详情表中是掉落物的id,但是后端告诉我的是 物品掉落的怪物id
                    //if (TaskManager.Single().TaskToSMGoodsDic.ContainsKey(taskItem.missionid))
                    //{
                    //    smonsterId1 = TaskManager.Single().TaskToSMGoodsDic[taskItem.missionid].opt6;
                    //    //杀怪掉落物 后端没有告诉我 需要去获得几个  只告诉我已经获得的数量
                    //    //if (TaskManager.Single().TaskSMGoodsCountDic.ContainsKey(smonsterId1))
                    //    //{
                    //    //    smGoodsCount = TaskManager.Single().TaskSMGoodsCountDic[smonsterId1];
                    //    //}
                    //}

                    //long trackingIndex = taskDataNode.Opt2;
                    //if (FSDataNodeTable<CollectNode>.GetSingleton().DataNodeList.ContainsKey(trackingIndex))
                    //{
                    //    itemId = FSDataNodeTable<CollectNode>.GetSingleton().DataNodeList[trackingIndex].collectid[0, 0];
                    //}

                    //taskData.content = taskItem.tasknode.Require.Replace("c1", GameLibrary.C1)
                    //                                             .Replace("c2", GameLibrary.C2)
                    //                                             .Replace("c3", GameLibrary.C3)
                    //                                             .Replace("c4", GameLibrary.C4)
                    //                                             .Replace("c5", GameLibrary.C5)
                    //                                             .Replace("c6", GameLibrary.C6)
                    //                                             .Replace("%d" + itemId, GetTaskGoodsCount(taskDataNode.Requiretype, itemId, taskItem).ToString());
                }
                else if (taskDataNode.Requiretype == 8)//背包物品数量显示
                {
                    long itemId1 = 0;
                    long itemId2 = 0;

                    Dictionary <long, int> idAndcountDic = taskDataNode.IdAndcountDic;
                    List <long>            idArr         = new List <long>();
                    foreach (long id in idAndcountDic.Keys)
                    {
                        idArr.Add(id);
                    }
                    if (idArr.Count >= 1)
                    {
                        itemId1 = idArr[0];
                    }
                    if (idArr.Count >= 2)
                    {
                        itemId2 = idArr[1];
                    }
                    taskData.content = taskItem.tasknode.Require.Replace("c1", GameLibrary.C1)
                                       .Replace("c2", GameLibrary.C2)
                                       .Replace("c3", GameLibrary.C3)
                                       .Replace("c4", GameLibrary.C4)
                                       .Replace("c5", GameLibrary.C5)
                                       .Replace("c6", GameLibrary.C6)
                                       .Replace("%d" + itemId1, GetTaskGoodsCount(taskDataNode.Requiretype, itemId1, taskItem).ToString())
                                       .Replace("%d" + itemId2, GetTaskGoodsCount(taskDataNode.Requiretype, itemId2, taskItem).ToString());
                }
                else
                {
                    taskData.content = taskItem.tasknode.Require.Replace("c1", GameLibrary.C1)
                                       .Replace("c2", GameLibrary.C2)
                                       .Replace("c3", GameLibrary.C3)
                                       .Replace("c4", GameLibrary.C4)
                                       .Replace("c5", GameLibrary.C5)
                                       .Replace("c6", GameLibrary.C6);
                }
            }

            taskData.taskState = taskItem.taskProgress;
            taskDataList.Add(taskData);
        }
        //添加其他任务信息
        GetRewardData();
        CreatTaskList();
    }
Exemple #3
0
    protected override void ShowHandler()
    {
        Control.HideGUI(UIPanleID.UIMoney);
        Control.HideGUI(UIPanleID.UIRole);
        Control.HideGUI(UIPanleID.UISetting);
        Control.HideGUI(UIPanleID.UITaskTracker);
        Control.HideGUI(UIPanleID.UIChat);
        //Control.HideGUI(GameLibrary.UIMail);
        GameObject.Destroy(npcmodel);
        //当前NPC身上所带任务列表
        //List<TaskItem> tasklist = TaskManager.Single().GetNPCTaskList(npcid);
        NPCNode npcNode = FSDataNodeTable <NPCNode> .GetSingleton().FindDataByType(npcid);

        ArrayList showTaskList = new ArrayList();

        //功能按钮
        for (int i = 0; i < TaskManager.Single().CurrentShowDialogItem.opt.Length; i++)
        {
            //是空就跳转 最后一个是关闭按钮
            if (string.IsNullOrEmpty(TaskManager.Single().CurrentShowDialogItem.opt[i]))
            {
                continue;//这个应该是return, 不然的话 下面 i+1就乱了
            }
            string[] functionbtn = new string[4];
            //任务索引要告诉后端选择的是哪个任务
            functionbtn[0] = (i + 1) + "";
            //任务名称
            functionbtn[1] = TaskManager.Single().CurrentShowDialogItem.opt[i];
            //区分完成状态
            functionbtn[2] = TaskManager.Single().CurrentShowDialogItem.user[1].ToString();//user2
            //区分主线支线
            functionbtn[3] = "1";
            showTaskList.Add(functionbtn);
        }

        ////关闭按钮
        //string[] strclose = new string[4];
        //strclose[0] = "-1";
        //strclose[1] = "路过而已";
        //strclose[2] = "1";
        //strclose[3] = "1";
        //showTaskList.Add(strclose);

        //multList.InSize(showTaskList.Count, 2);
        //multList.Info(showTaskList.ToArray());
        currentindex = int.Parse(((string[])showTaskList[0])[0]);
        if (TaskManager.Single().CurrentShowDialogItem != null)
        {
            List <ItemData> itemlist = TaskManager.Single().GetItemList(TaskManager.Single().CurrentShowDialogItem.msId);
            goodsScrollView.ResetPosition();
            goodsMultList.InSize(itemlist.Count, itemlist.Count);
            goodsMultList.Info(itemlist.ToArray());
        }
        if (FSDataNodeTable <TaskDataNode> .GetSingleton().DataNodeList.ContainsKey(TaskManager.Single().CurrentShowDialogItem.msId))
        {
            tasknode = FSDataNodeTable <TaskDataNode> .GetSingleton().DataNodeList[TaskManager.Single().CurrentShowDialogItem.msId];

            taskName.text    = tasknode.Taskname;
            taskContent.text = tasknode.Require.Replace("c1", GameLibrary.C1)
                               .Replace("c2", GameLibrary.C2)
                               .Replace("c3", GameLibrary.C3)
                               .Replace("c4", GameLibrary.C4)
                               .Replace("c5", GameLibrary.C5)
                               .Replace("c6", GameLibrary.C6);
            if (tasknode.Requiretype == 3)//采集数量显示
            {
                long collectID1 = 0;
                long collectID2 = 0;
                if (TaskManager.Single().TaskToCaijiDic.ContainsKey(TaskManager.Single().CurrentShowDialogItem.msId))
                {
                    collectID1 = TaskManager.Single().TaskToCaijiDic[TaskManager.Single().CurrentShowDialogItem.msId].opt4;
                    collectID2 = TaskManager.Single().TaskToCaijiDic[TaskManager.Single().CurrentShowDialogItem.msId].opt6;
                    //if (TaskManager.Single().TaskItemCountsDic.ContainsKey(collectID))
                    //{
                    //    if (TaskManager.Single().TaskItemCountsDic[collectID] < TaskManager.Single().TaskToCaijiDic[_taskItem.missionid].opt5)
                    //    {
                    //        caijiCount = TaskManager.Single().TaskItemCountsDic[collectID];
                    //    }
                    //    else
                    //    {
                    //        caijiCount = (int)TaskManager.Single().TaskToCaijiDic[_taskItem.missionid].opt5;
                    //    }
                    //}
                    //else
                    //{
                    //    caijiCount = 0;
                    //}
                }
                else//后端给我的信息是在 接收任务之后。这就导致未接的时候找不到ID,没法替换追踪显示中的数量。这时候我自己去读表
                {
                    if (tasknode.Opt5.Length > 0)
                    {
                        long trackingIndex = tasknode.Opt5[0];
                        if (FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList.ContainsKey(trackingIndex))
                        {
                            collectID1 = FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[trackingIndex].collectid[0, 0];
                        }
                    }
                    if (tasknode.Opt5.Length > 1)
                    {
                        long trackingIndex = tasknode.Opt5[1];
                        if (FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList.ContainsKey(trackingIndex))
                        {
                            collectID2 = FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[trackingIndex].collectid[0, 0];
                        }
                    }
                }
                taskContent.text = tasknode.Require.Replace("c1", GameLibrary.C1)
                                   .Replace("c2", GameLibrary.C2)
                                   .Replace("c3", GameLibrary.C3)
                                   .Replace("c4", GameLibrary.C4)
                                   .Replace("c5", GameLibrary.C5)
                                   .Replace("c6", GameLibrary.C6)
                                   .Replace("%d" + collectID1, "0")
                                   .Replace("%d" + collectID2, "0");
            }
            else if (tasknode.Requiretype == 6)//杀怪数量显示
            {
                long monsterId1 = 0;
                long monsterId2 = 0;
                if (TaskManager.Single().TaskToSkillMonsterDic.ContainsKey(TaskManager.Single().CurrentShowDialogItem.msId))
                {
                    //暂时杀怪是两种 最多三种
                    monsterId1 = TaskManager.Single().TaskToSkillMonsterDic[TaskManager.Single().CurrentShowDialogItem.msId].opt4;
                    monsterId2 = TaskManager.Single().TaskToSkillMonsterDic[TaskManager.Single().CurrentShowDialogItem.msId].opt6;
                    //if (TaskManager.Single().TaskSkillMonsterCountsDic.ContainsKey(monsterId1))
                    //{
                    //    if (TaskManager.Single().TaskSkillMonsterCountsDic[monsterId1] < TaskManager.Single().TaskToSkillMonsterDic[_taskItem.missionid].opt5)
                    //    {
                    //        monster1Count = TaskManager.Single().TaskSkillMonsterCountsDic[monsterId1];
                    //    }
                    //    else
                    //    {
                    //        monster1Count = (int)TaskManager.Single().TaskToSkillMonsterDic[_taskItem.missionid].opt5;
                    //    }
                    //}
                    //if (TaskManager.Single().TaskSkillMonsterCountsDic.ContainsKey(monsterId2))
                    //{
                    //    if (TaskManager.Single().TaskSkillMonsterCountsDic[monsterId2] < TaskManager.Single().TaskToSkillMonsterDic[_taskItem.missionid].opt7)
                    //    {
                    //        monster2Count = TaskManager.Single().TaskSkillMonsterCountsDic[monsterId2];
                    //    }
                    //    else
                    //    {
                    //        monster2Count = (int)TaskManager.Single().TaskToSkillMonsterDic[_taskItem.missionid].opt7;
                    //    }
                    //}
                }
                else
                {
                    Dictionary <long, int> idAndcountDic = tasknode.IdAndcountDic;
                    List <long>            idArr         = new List <long>();
                    foreach (long id in idAndcountDic.Keys)
                    {
                        idArr.Add(id);
                    }
                    if (idArr.Count >= 2)
                    {
                        monsterId1 = idArr[0];
                        monsterId2 = idArr[1];
                    }
                    else if (idArr.Count == 1)
                    {
                        monsterId1 = idArr[0];
                    }
                }
                taskContent.text = tasknode.Require.Replace("c1", GameLibrary.C1)
                                   .Replace("c2", GameLibrary.C2)
                                   .Replace("c3", GameLibrary.C3)
                                   .Replace("c4", GameLibrary.C4)
                                   .Replace("c5", GameLibrary.C5)
                                   .Replace("c6", GameLibrary.C6)
                                   .Replace("%d" + monsterId1, "0")
                                   .Replace("%d" + monsterId2, "0");
            }
            else if (tasknode.Requiretype == 7)//杀怪掉落物显示
            {
                long itemId1 = 0;
                long itemId2 = 0;
                if (TaskManager.Single().TaskToSMGoodsDic.ContainsKey(TaskManager.Single().CurrentShowDialogItem.msId))
                {
                    itemId1 = TaskManager.Single().TaskToSMGoodsDic[TaskManager.Single().CurrentShowDialogItem.msId].opt4;
                    itemId2 = TaskManager.Single().TaskToSMGoodsDic[TaskManager.Single().CurrentShowDialogItem.msId].opt6;
                }

                long trackingIndex = tasknode.Opt2;
                if (FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList.ContainsKey(trackingIndex))
                {
                    if (FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[trackingIndex].collectid.GetLength(0) >= 2)
                    {
                        itemId1 = FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[trackingIndex].collectid[0, 0];

                        itemId2 = FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[trackingIndex].collectid[1, 0];
                    }
                    else if (FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[trackingIndex].collectid.GetLength(0) == 1)
                    {
                        itemId1 = FSDataNodeTable <CollectNode> .GetSingleton().DataNodeList[trackingIndex].collectid[0, 0];
                    }
                }

                taskContent.text = tasknode.Require.Replace("c1", GameLibrary.C1)
                                   .Replace("c2", GameLibrary.C2)
                                   .Replace("c3", GameLibrary.C3)
                                   .Replace("c4", GameLibrary.C4)
                                   .Replace("c5", GameLibrary.C5)
                                   .Replace("c6", GameLibrary.C6)
                                   .Replace("%d" + itemId1, "0")
                                   .Replace("%d" + itemId2, "0");
                //long smonsterId1 = 0;
                //long itemId = 0;//任务详情表中是掉落物的id,但是后端告诉我的是 物品掉落的怪物id
                //if (TaskManager.Single().TaskToSMGoodsDic.ContainsKey(clickTaskItem.missionid))
                //{
                //    smonsterId1 = TaskManager.Single().TaskToSMGoodsDic[clickTaskItem.missionid].opt6;
                //    //杀怪掉落物 后端没有告诉我 需要去获得几个  只告诉我已经获得的数量
                //    //if (TaskManager.Single().TaskSMGoodsCountDic.ContainsKey(smonsterId1))
                //    //{
                //    //    smGoodsCount = TaskManager.Single().TaskSMGoodsCountDic[smonsterId1];
                //    //}
                //}

                //long trackingIndex = clickTaskItem.tasknode.Opt2;
                //if (FSDataNodeTable<CollectNode>.GetSingleton().DataNodeList.ContainsKey(trackingIndex))
                //{
                //    itemId = FSDataNodeTable<CollectNode>.GetSingleton().DataNodeList[trackingIndex].collectid[0, 0];
                //}

                //tasktargetlab1.text = clickTaskItem.tasknode.Require.Replace("c1", GameLibrary.C1)
                //                                             .Replace("c2", GameLibrary.C2)
                //                                             .Replace("c3", GameLibrary.C3)
                //                                             .Replace("c4", GameLibrary.C4)
                //                                             .Replace("c5", GameLibrary.C5)
                //                                             .Replace("c6", GameLibrary.C6)
                //                                             .Replace("%d" + itemId, GetTaskGoodsCount(clickTaskItem.tasknode.Requiretype, itemId, clickTaskItem).ToString());
            }
            else if (tasknode.Requiretype == 8)//背包物品数量显示
            {
                long itemId1 = 0;
                long itemId2 = 0;

                Dictionary <long, int> idAndcountDic = tasknode.IdAndcountDic;
                List <long>            idArr         = new List <long>();
                foreach (long id in idAndcountDic.Keys)
                {
                    idArr.Add(id);
                }
                if (idArr.Count >= 1)
                {
                    itemId1 = idArr[0];
                }
                if (idArr.Count >= 2)
                {
                    itemId1 = idArr[0];
                    itemId2 = idArr[1];
                }
                taskContent.text = tasknode.Require.Replace("c1", GameLibrary.C1)
                                   .Replace("c2", GameLibrary.C2)
                                   .Replace("c3", GameLibrary.C3)
                                   .Replace("c4", GameLibrary.C4)
                                   .Replace("c5", GameLibrary.C5)
                                   .Replace("c6", GameLibrary.C6)
                                   .Replace("c6", GameLibrary.C6)
                                   .Replace("%d" + itemId1, "0")
                                   .Replace("%d" + itemId2, "0");
            }
        }

        //根据NPC 查找内容与名称
        npcname.text = npcNode.npcname;
        //contont.text = TaskManager.Single().CurrentShowDialogItem.disc;
        if (FSDataNodeTable <ModelNode> .GetSingleton().DataNodeList.ContainsKey(npcNode.modelid))
        {
            //CrearteNpcModel(FSDataNodeTable<ModelNode>.GetSingleton().DataNodeList[npcNode.modelid].respath);
            heroObj = HeroPosEmbattle.instance.CreatModelByModelID((int)npcNode.modelid, PosType.NpcPos, transform.Find("HeroTexture").GetComponent <SpinWithMouse>(), MountAndPet.Null, 160);
        }
    }
Exemple #4
0
    public Dictionary <long, int> TaskSMGoodsCountDic       = new Dictionary <long, int>(); // 杀怪掉落物物品数量 掉落物id --- cout (后端告诉我的是怪物id,我读表转换成掉落物id)

    //任何任务发生变化调用
    public void ModifeTask(TaskItem _taskItem, TaskModifyType modifetype)
    {
        //将任务 对应npc存放 (用于点击npc 给服务器发送 npcid 和 任务id)
        if (NpcTaskListDic.ContainsKey(_taskItem.npcid))
        {
            if (NpcTaskListDic[_taskItem.npcid].ContainsKey(_taskItem.missionid))
            {
                NpcTaskListDic[_taskItem.npcid][_taskItem.missionid] = _taskItem;
            }
            else
            {
                NpcTaskListDic[_taskItem.npcid].Add(_taskItem.missionid, _taskItem);
            }
        }
        else
        {
            if (_taskItem.missionid != 0)
            {
                Dictionary <int, TaskItem> temp = new Dictionary <int, TaskItem>();
                temp.Add(_taskItem.missionid, _taskItem);
                //NpcTaskListDic.Add(_taskItem.npcid,new Dictionary<int, TaskItem>() { { _taskItem.missionid, _taskItem } });
                NpcTaskListDic.Add(_taskItem.npcid, temp);
            }
        }
        //将任务状态对应npc存放 (用于显示npc头顶的状态)
        //taskindex == 0 是主线其他都支线
        if (_taskItem.taskindex == 0)
        {
            MainTask = _taskItem;
            if (_taskItem.npcid != 0)
            {
                if (!NpcTaskStateDic.ContainsKey(_taskItem.npcid))
                {
                    NpcTaskStateDic.Add(_taskItem.npcid, new List <TaskProgress> {
                        _taskItem.taskProgress
                    });
                }
                else
                {
                    if (!NpcTaskStateDic[_taskItem.npcid].Contains(_taskItem.taskProgress))
                    {
                        NpcTaskStateDic[_taskItem.npcid].Add(_taskItem.taskProgress);
                    }
                }
            }
        }
        else//支线
        {
            BranchList.Add(_taskItem.missionid, _taskItem);
            if (_taskItem.npcid != 0)
            {
                if (!NpcTaskStateDic.ContainsKey(_taskItem.npcid))
                {
                    NpcTaskStateDic.Add(_taskItem.npcid, new List <TaskProgress> {
                        _taskItem.taskProgress
                    });
                }
                else
                {
                    if (!NpcTaskStateDic[_taskItem.npcid].Contains(_taskItem.taskProgress))
                    {
                        NpcTaskStateDic[_taskItem.npcid].Add(_taskItem.taskProgress);
                    }
                }
            }
        }
        ChangeTaskList(_taskItem);

        /*
         * 1:对话;
         * 2:通关副本;
         * 3:采集;
         * 4:提升技能等级;
         * 5:提升英雄装备等级;
         * 6:杀怪;
         * 7:怪物掉落物;
         * 8:背包物品;
         * 9:指定地点;
         */
        //清除已经完成的任务信息
        if (FSDataNodeTable <TaskDataNode> .GetSingleton().DataNodeList.ContainsKey(_taskItem.missionid))
        {
            TaskDataNode taskDataNode = FSDataNodeTable <TaskDataNode> .GetSingleton().DataNodeList[_taskItem.missionid];

            if (taskDataNode.Requiretype == 2)
            {
                if (_taskItem.taskProgress == TaskProgress.Reward)
                {
                    if (TaskToFubenDic.ContainsKey(_taskItem.missionid))
                    {
                        TaskToFubenDic.Remove(_taskItem.missionid);
                    }
                }
            }
            if (taskDataNode.Requiretype == 3)
            {
                if (_taskItem.taskProgress == TaskProgress.Reward)
                {
                    if (TaskToCaijiDic.ContainsKey(_taskItem.missionid))
                    {
                        TaskToCaijiDic.Remove(_taskItem.missionid);
                    }
                }
            }
            if (taskDataNode.Requiretype == 6)
            {
                if (_taskItem.taskProgress == TaskProgress.Reward)
                {
                    if (TaskToSkillMonsterDic.ContainsKey(_taskItem.missionid))
                    {
                        TaskToSkillMonsterDic.Remove(_taskItem.missionid);
                    }
                }
            }
            if (taskDataNode.Requiretype == 7)
            {
                if (_taskItem.taskProgress == TaskProgress.Reward)
                {
                    if (TaskToSMGoodsDic.ContainsKey(_taskItem.missionid))
                    {
                        TaskToSMGoodsDic.Remove(_taskItem.missionid);
                    }
                }
            }
            if (taskDataNode.Requiretype == 9)
            {
                if (_taskItem.taskProgress == TaskProgress.Reward)
                {
                    if (TaskToTargetUseItemDic.ContainsKey(_taskItem.missionid))
                    {
                        TaskToTargetUseItemDic.Remove(_taskItem.missionid);
                    }
                }
            }
        }


        //任务变化执行
        //if (OnTaskChange != null)
        //{
        //    OnTaskChange(_taskItem, new TaskArgs() { modifietype = modifetype });
        //}

        //switch ((TaskClass)_taskItem.tasknode.Type)
        //{
        //    case TaskClass.Main:
        //        switch (modifetype)
        //        {
        //            case TaskModifyType.Add:
        //            case TaskModifyType.Change:
        //                MainTask = _taskItem;

        //                break;
        //            case TaskModifyType.Remove:
        //                MainTask = null;//实际是指向下一个主线任务 再次判定
        //                break;
        //            default:
        //                break;
        //        }

        //        break;
        //    case TaskClass.Branch:
        //        switch (modifetype)
        //        {
        //            case TaskModifyType.Add:
        //                BranchList.Add(_taskItem.missionid, _taskItem);
        //                break;
        //            case TaskModifyType.Change:
        //                BranchList[_taskItem.missionid] = _taskItem;
        //                break;
        //            case TaskModifyType.Remove:
        //                BranchList.Remove(_taskItem.missionid);
        //                break;
        //            default:
        //                break;
        //        }
        //        break;
        //    default:
        //        break;
        //}
        //ChangeTaskList(_taskItem);
        ////任务变化执行
        //if (OnTaskChange != null)
        //{
        //    OnTaskChange(_taskItem, new TaskArgs() { modifietype = modifetype });
        //}
    }
Exemple #5
0
    /// <summary>
    /// 任务列表
    /// </summary>
    /// <param name="packet"></param>
    /// <returns></returns>
    public bool TaskListResult(CReadPacket packet)
    {
        Debug.Log("TaskListResult任务列表");
        ClearTaskData();
        Dictionary <string, object> data = packet.data;
        int resolt = int.Parse(data["ret"].ToString());

        if (resolt == 0)
        {
            object[] missionlist = data["misinfo"] as object[];
            if (missionlist == null)
            {
                return(false);
            }
            TaskInstructionsNode taskInstructionsNode = null;
            for (int i = 0; i < missionlist.Length; i++)
            {
                object[] taskDataDic = missionlist[i] as object[];
                if (i == 0)
                {
                    TaskItem taskitem = new TaskItem();
                    taskitem.taskindex = int.Parse(taskDataDic[0].ToString());//0是主线 其他的都是次线任务
                    taskitem.missionid = int.Parse(taskDataDic[1].ToString());
                    TaskDataNode taskDataNode = FSDataNodeTable <TaskDataNode> .GetSingleton().FindDataByType(taskitem.missionid);

                    //if (taskDataNode == null)
                    //{
                    //    continue;
                    //}
                    taskitem.tasknode = taskDataNode;
                    taskitem.scripid  = int.Parse(taskDataDic[2].ToString());
                    taskitem.able     = bool.Parse(taskDataDic[3].ToString());
                    //if (!TaskManager.Single().taskstate.ContainsKey(taskitem.missionid))
                    //{
                    //    continue;
                    //}
                    //if (!TaskManager.Single().TaskInstructionsNodeMap.ContainsKey(taskitem.missionid))
                    //{
                    //    continue;
                    //}
                    if (TaskManager.Single().TaskInstructionsNodeMap.ContainsKey(taskitem.missionid))
                    {
                        taskInstructionsNode = TaskManager.Single().TaskInstructionsNodeMap[taskitem.missionid];
                        int statevalue = TaskManager.Single().taskstate[taskInstructionsNode.indexarr];
                        int state      = TaskManager.Single().GetBitValue(statevalue, taskInstructionsNode.zeroposition, taskInstructionsNode.length);
                        taskitem.taskProgress = (TaskProgress)state;
                    }
                    taskitem.parm0 = long.Parse(taskDataDic[4].ToString());
                    taskitem.parm1 = long.Parse(taskDataDic[5].ToString()); //第一个数量
                    taskitem.parm2 = long.Parse(taskDataDic[6].ToString()); //第二个数量
                    taskitem.parm3 = long.Parse(taskDataDic[7].ToString());
                    taskitem.npcid = long.Parse(taskDataDic[8].ToString()); //当前任务的npc
                    taskitem.parm4 = long.Parse(taskDataDic[9].ToString());

                    ////针对杀怪任务掉落物 相关信息在这里接收
                    //if (taskDataNode != null && taskDataNode.Requiretype == 7)
                    //{
                    //    FubenTaskData fubenTaskData = new FubenTaskData();
                    //    // fubenTaskData.opt1 = int.Parse(data["opt1"].ToString());
                    //    //fubenTaskData.taskType = int.Parse(data["opt2"].ToString());
                    //    fubenTaskData.taskId = taskitem.missionid;
                    //    fubenTaskData.opt4 = taskitem.parm0;
                    //    fubenTaskData.opt5 = taskitem.parm1;//已经获得的掉落物数量
                    //    fubenTaskData.opt6 = taskitem.parm2;//怪物id

                    //    if (TaskManager.Single().TaskToSMGoodsDic.ContainsKey(fubenTaskData.taskId))
                    //    {
                    //        TaskManager.Single().TaskToSMGoodsDic[fubenTaskData.taskId] = fubenTaskData;
                    //    }
                    //    else
                    //    {
                    //        TaskManager.Single().TaskToSMGoodsDic.Add(fubenTaskData.taskId, fubenTaskData);
                    //    }
                    //    //存储杀怪掉落物的数量 杀怪掉落物id --  杀怪掉落物数量  (后端告诉我的是怪物id 读表转换)
                    //    if (TaskManager.Single().TaskToSMGoodsDic.ContainsKey(taskitem.missionid))
                    //    {
                    //        //long monsterId1 = TaskManager.Single().TaskToSMGoodsDic[taskitem.missionid].opt6;
                    //        long trackingIndex = taskDataNode.Opt2;//采集表id 得到怪物id
                    //        long itemId = 0;
                    //        if (FSDataNodeTable<CollectNode>.GetSingleton().DataNodeList.ContainsKey(trackingIndex))
                    //        {
                    //            itemId = FSDataNodeTable<CollectNode>.GetSingleton().DataNodeList[trackingIndex].collectid[0, 0];
                    //        }

                    //        if (TaskManager.Single().TaskSMGoodsCountDic.ContainsKey(itemId))
                    //        {
                    //            TaskManager.Single().TaskSMGoodsCountDic[itemId] = (int)fubenTaskData.opt5;
                    //        }
                    //        else
                    //        {
                    //            TaskManager.Single().TaskSMGoodsCountDic.Add(itemId, (int)fubenTaskData.opt5);
                    //        }

                    //    }

                    //}
                    if (TaskManager.Single().CurrentShowDialogItem != null)
                    {
                        if (taskitem.taskProgress == TaskProgress.Complete && taskitem.missionid == TaskManager.Single().CurrentShowDialogItem.msId)
                        {
                            TaskManager.Single().CurrentTaskItem = taskitem;
                        }
                    }

                    TaskManager.Single().ModifeTask(taskitem, TaskModifyType.Add);
                }
                if (i >= 1 && i <= 9)
                {
                }
            }
            if (Singleton <SceneManage> .Instance.Current == EnumSceneID.UI_MajorCity01 || Singleton <SceneManage> .Instance.Current == EnumSceneID.LGhuangyuan)
            {
                //Control.ShowGUI(GameLibrary.UITaskTracker);
            }
        }
        else
        {
            Debug.Log(data["desc"].ToString());
        }
        return(true);
    }