예제 #1
0
        private void get_associate_lvls_res(Variant msgData)
        {
            int res = msgData["res"];

            switch (res)
            {
            case 3:
                int camid = msgData["trig_id"];
                //检测是否有摄像机动画
                SceneCamera.CheckTrrigerCam(camid);
                //检测是否有剧情对白
                if (a3_trrigerDialog.instance != null)
                {
                    a3_trrigerDialog.instance.CheckDialog(camid);
                }
                break;
            }


            if (GameRoomMgr.getInstance().onLevelStatusChanges(msgData))
            {
                return;
            }
            NetClient.instance.dispatchEvent(
                GameEvent.Create(PKG_NAME.S2C_GET_ASSOCIATE_LVLS_RES, this, GameTools.CreateSwitchData("get_associate_lvls_res", msgData))
                );
            //GameSession(this.session).logicClient.logicInGame.lgGD_levels.get_associate_lvls_res(msgData);
        }
예제 #2
0
        //public void sendmoveto(float frm_x, float frm_y, float to_x, float to_y, float start_tm,bool force=false)
        //{
        //    //Variant msg = Variant.alloc();
        //    //msg["frm_x"] = frm_x;
        //    //msg["frm_y"] = frm_y;
        //    //msg["to_x"] = to_x;
        //    //msg["to_y"] = to_y;
        //    //msg["start_tm"] = start_tm;
        //    //sendRPC(PKG_NAME.C2S_MOVE, msg);
        //    //Variant.free(msg);

        //    ReqChangeMoveMsg((uint)frm_x, (uint)frm_y, (uint)to_x, (uint)to_y, (uint)start_tm,-1f, force);
        //}

        //public void sendmoveRadian(float frm_x, float frm_y, float radian, float start_tm)
        //{
        //    //float ori = (radian * 180) / (float)(Math.PI * 100);
        //    LGMap lgm =  GRClient.instance.g_gameM.getObject(OBJECT_NAME.LG_MAP) as LGMap;
        //    Vec2 tp = lgm.getFarthestGPosByOri(frm_x, frm_y, radian * (float)Math.PI / 180);

        //    float to_x = (float)(tp.x ) + GameConstant.GEZI;
        //    float to_y = (float)(tp.y ) + GameConstant.GEZI;
        //    ReqChangeMoveMsg((uint)frm_x, (uint)frm_y, (uint)to_x, (uint)to_y, (uint)start_tm, radian);

        //    ////if (moveTick > 20)
        //    //{
        //    //    //    debug.Log("处理移动消息.9..");
        //    //    //    moveTick = 0;
        //    //    Variant msg = Variant.alloc();
        //    //    msg["frm_x"] = frm_x;
        //    //    msg["frm_y"] = frm_y;
        //    //    msg["iid"] = 0;
        //    //    msg["start_tm"] = start_tm;
        //    //    msg["radian"] = radian;
        //    //    sendRPC(PKG_NAME.C2S_MOVE, msg);
        //    //    Variant.free(msg);
        //    //}
        //}

        public void pos_correct(Variant msgData)
        {
            debug.Log("KKKKUUUUU" + msgData.dump());
            uint           iid = msgData["iid"]._uint;
            ProfessionRole pr  = OtherPlayerMgr._inst.GetOtherPlayer(iid);

            if (pr != null)
            {
            }
            else
            {
                float       to_x = msgData["x"]._float / GameConstant.PIXEL_TRANS_UNITYPOS;
                float       to_y = msgData["y"]._float / GameConstant.PIXEL_TRANS_UNITYPOS;
                MonsterRole role = MonsterMgr._inst.getServerMonster(iid);
                if (role != null)
                {
                    Vector3 vec = new Vector3(to_x, role.m_curModel.position.y, to_y);
                    if (GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342] || GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3358])
                    {//解决多层阻挡点寻路的问题
                        role.pos_correct(vec);
                    }
                    else
                    {
                        NavMeshHit hit;
                        NavMesh.SamplePosition(vec, out hit, 100f, role.m_layer);
                        role.pos_correct(hit.position);
                    }
                }
            }
        }
예제 #3
0
        public void refreshInfo()
        {
            if (open_id < 0)
            {
                return;
            }

            if (!GameRoomMgr.getInstance().checkCityRoom())
            {
                return;
            }

            this.gameObject.SetActive(true);

            ig_icon  = transform.FindChild("mover/icon").GetComponent <Image>();
            ig_icon1 = transform.FindChild("icon").GetComponent <Image>();
            string file = "icon_skill_" + open_id;

            ig_icon.sprite  = GAMEAPI.ABUI_LoadSprite(file);
            ig_icon1.sprite = GAMEAPI.ABUI_LoadSprite(file);
            ig_icon.gameObject.SetActive(true);

            CancelInvoke("timeGo");
            Invoke("timeGo", 3.3f);

            runAni(x, y);

            if (a3_expbar.instance != null)
            {
                a3_expbar.instance.On_Btn_Up();
            }

            open_id = -1;
        }
예제 #4
0
        private void lvl_get_prize_res(Variant msgData)
        {
            bool flag  = GameRoomMgr.getInstance().onPrizeFinish(msgData);
            bool flag2 = flag;

            if (!flag2)
            {
                Debug.LogError("KKKKK" + msgData.dump());
                PVPRoom.instan.refGet(msgData["ach_point"], msgData["exp"]);
                List <MapItemData> list = new List <MapItemData>();
                bool flag3 = msgData.ContainsKey("rewards");
                if (flag3)
                {
                    List <Variant> arr = msgData["rewards"]._arr;
                    foreach (Variant current in arr)
                    {
                        list.Add(new MapItemData
                        {
                            count = current["cnt"],
                            id    = current["tpid"]
                        });
                    }
                }
            }
        }
예제 #5
0
        public void refreshInfo()
        {
            bool flag = this.open_id < 0;

            if (!flag)
            {
                bool flag2 = !GameRoomMgr.getInstance().checkCityRoom();
                if (!flag2)
                {
                    base.gameObject.SetActive(true);
                    this.ig_icon  = base.transform.FindChild("mover/icon").GetComponent <Image>();
                    this.ig_icon1 = base.transform.FindChild("icon").GetComponent <Image>();
                    string path = "icon/rune/" + this.open_id;
                    this.ig_icon.sprite  = (Resources.Load(path, typeof(Sprite)) as Sprite);
                    this.ig_icon1.sprite = (Resources.Load(path, typeof(Sprite)) as Sprite);
                    this.ig_icon.gameObject.SetActive(true);
                    base.CancelInvoke("timeGo");
                    base.Invoke("timeGo", 3.3f);
                    this.runAni(this.x, this.y);
                    bool flag3 = a3_expbar.instance != null;
                    if (flag3)
                    {
                        a3_expbar.instance.On_Btn_Up();
                    }
                    this.open_id = -1;
                }
            }
        }
예제 #6
0
        void onModeExp(Variant msgData)
        {
            PlayerModel.getInstance().exp = PlayerModel.getInstance().exp + msgData["mod_exp"];

            var maxExp = PlayerModel.getInstance().GetCurrMaxExp();

            if (maxExp != 0u)
            {
                PlayerModel.getInstance().exp = PlayerModel.getInstance().exp >= maxExp ? maxExp : PlayerModel.getInstance().exp;
            }

            debug.Log("经验增加:" + msgData["mod_exp"]);
            if (flytxt.instance)
            {
                flytxt.instance.fly("EXP+" + msgData["mod_exp"], 3);
            }
            if (a3_insideui_fb.instance != null)
            {
                a3_insideui_fb.instance.SetInfExp(msgData["mod_exp"]);
            }
            if (GameRoomMgr.getInstance().curRoom != null)
            {
                GameRoomMgr.getInstance().curRoom.onAddExp(msgData["mod_exp"]);
            }


            if (msgData.ContainsKey("cur_exp"))
            {
                PlayerModel.getInstance().exp = msgData["cur_exp"];
            }
            InterfaceMgr.doCommandByLua("PlayerModel:getInstance().modExp", "model/PlayerModel", PlayerModel.getInstance().exp);
            dispatchEvent(GameEvent.Create(EVENT_ON_EXP_CHANGE, this, msgData));
        }
예제 #7
0
        private void onModeExp(Variant msgData)
        {
            ModelBase <PlayerModel> .getInstance().exp = ModelBase <PlayerModel> .getInstance().exp + msgData["mod_exp"];

            debug.Log("经验增加:" + msgData["mod_exp"]);
            bool flag = flytxt.instance;

            if (flag)
            {
                flytxt.instance.fly("EXP+" + msgData["mod_exp"], 3, default(Color), null);
            }
            bool flag2 = a3_insideui_fb.instance != null;

            if (flag2)
            {
                a3_insideui_fb.instance.SetInfExp(msgData["mod_exp"]);
            }
            bool flag3 = GameRoomMgr.getInstance().curRoom != null;

            if (flag3)
            {
                GameRoomMgr.getInstance().curRoom.onAddExp(msgData["mod_exp"]);
            }
            bool flag4 = msgData.ContainsKey("cur_exp");

            if (flag4)
            {
                ModelBase <PlayerModel> .getInstance().exp = msgData["cur_exp"];
            }
            InterfaceMgr.doCommandByLua("PlayerModel:getInstance().modExp", "model/PlayerModel", new object[]
            {
                ModelBase <PlayerModel> .getInstance().exp
            });
            base.dispatchEvent(GameEvent.Create(PlayerInfoProxy.EVENT_ON_EXP_CHANGE, this, msgData, false));
        }
예제 #8
0
        public void pos_correct(Variant msgData)
        {
            debug.Log("KKKKUUUUU" + msgData.dump());
            uint           @uint       = msgData["iid"]._uint;
            ProfessionRole otherPlayer = OtherPlayerMgr._inst.GetOtherPlayer(@uint);
            bool           flag        = otherPlayer != null;

            if (!flag)
            {
                float       x             = msgData["x"]._float / 53.333f;
                float       z             = msgData["y"]._float / 53.333f;
                MonsterRole serverMonster = MonsterMgr._inst.getServerMonster(@uint);
                bool        flag2         = serverMonster != null;
                if (flag2)
                {
                    Vector3 vector = new Vector3(x, serverMonster.m_curModel.position.y, z);
                    bool    flag3  = GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342u];
                    if (flag3)
                    {
                        serverMonster.pos_correct(vector);
                    }
                    else
                    {
                        NavMeshHit navMeshHit;
                        NavMesh.SamplePosition(vector, out navMeshHit, 100f, serverMonster.m_layer);
                        serverMonster.pos_correct(navMeshHit.position);
                    }
                }
            }
        }
예제 #9
0
        public void flygetText(DropItem item)
        {
            bool flag = item.itemdta.tpid == 0;

            if (flag)
            {
                MediaClient.instance.PlaySoundUrl("audio/common/collect_coin", false, null);
                bool flag2 = GameRoomMgr.getInstance().curRoom != null;
                if (flag2)
                {
                    GameRoomMgr.getInstance().curRoom.onPickMoney(item.itemdta.count);
                }
                bool flag3 = a3_insideui_fb.instance != null;
                if (flag3)
                {
                    this.goldnum = (uint)a3_insideui_fb.instance.addmoney;
                }
                else
                {
                    this.goldnum += (uint)item.itemdta.count;
                }
            }
            else
            {
                string @string = item.itemdta.itemXml.getString("item_name");
                int    @int    = item.itemdta.itemXml.getInt("quality");
                flytxt.instance.fly(string.Concat(new object[]
                {
                    ContMgr.getCont("gameroom_pick", null),
                    Globle.getColorStrByQuality(@string, @int),
                    "x",
                    item.itemdta.count
                }), 0, default(Color), null);
                DropItemdta dropItemdta = new DropItemdta();
                dropItemdta.tpid = item.itemdta.itemXml.getInt("id");
                dropItemdta.num  = item.itemdta.count;
                foreach (DropItemdta current in this.list2)
                {
                    bool flag4 = dropItemdta.tpid == current.tpid;
                    if (flag4)
                    {
                        current.num += item.itemdta.count;
                        return;
                    }
                }
                this.list2.Add(dropItemdta);
            }
        }
예제 #10
0
        public void move(Variant msgData)
        {
            uint           @uint       = msgData["iid"]._uint;
            ProfessionRole otherPlayer = OtherPlayerMgr._inst.GetOtherPlayer(@uint);
            bool           flag        = otherPlayer != null;

            if (flag)
            {
                float   x      = msgData["to_x"]._float / 53.333f;
                float   z      = msgData["to_y"]._float / 53.333f;
                Vector3 vector = new Vector3(x, otherPlayer.m_curModel.position.y, z);
                bool    flag2  = GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342u];
                if (flag2)
                {
                    otherPlayer.SetDestPos(vector);
                }
                else
                {
                    NavMeshHit navMeshHit;
                    NavMesh.SamplePosition(vector, out navMeshHit, 100f, otherPlayer.m_layer);
                    otherPlayer.SetDestPos(navMeshHit.position);
                }
            }
            else
            {
                float       x2            = msgData["to_x"]._float / 53.333f;
                float       z2            = msgData["to_y"]._float / 53.333f;
                MonsterRole serverMonster = MonsterMgr._inst.getServerMonster(@uint);
                bool        flag3         = serverMonster != null;
                if (flag3)
                {
                    Vector3 vector2 = new Vector3(x2, serverMonster.m_curModel.position.y, z2);
                    bool    flag4   = GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342u];
                    if (flag4)
                    {
                        serverMonster.SetDestPos(vector2);
                    }
                    else
                    {
                        NavMeshHit navMeshHit2;
                        NavMesh.SamplePosition(vector2, out navMeshHit2, 100f, serverMonster.m_layer);
                        serverMonster.SetDestPos(navMeshHit2.position);
                    }
                }
            }
        }
예제 #11
0
        public void flygetText(DropItem item)
        {
            if (item.itemdta.tpid == 0)
            {
                MediaClient.instance.PlaySoundUrl("audio_common_collect_coin", false, null);
                // flytxt.instance.fly("拾取金币 " + item.itemdta.count);
                //已有金币添加飘字
                // if (a3_insideui_fb.instance != null) a3_insideui_fb.instance.SetInfMoney(item.itemdta.count);
                if (GameRoomMgr.getInstance().curRoom != null)
                {
                    GameRoomMgr.getInstance().curRoom.onPickMoney(item.itemdta.count);
                }

                //记录拾取金币
                //goldnum += (uint)item.itemdta.count;
                if (a3_insideui_fb.instance != null)
                {
                    goldnum = (uint)a3_insideui_fb.instance.addmoney;
                }
                else
                {
                    goldnum += (uint)item.itemdta.count;
                }
            }
            else
            {
                string name    = item.itemdta.itemXml.getString("item_name");
                int    quality = item.itemdta.itemXml.getInt("quality");
                flytxt.instance.fly(ContMgr.getCont("gameroom_pick") + Globle.getColorStrByQuality(name, quality) + "x" + item.itemdta.count);

                DropItemdta v = new DropItemdta();

                v.tpid = item.itemdta.itemXml.getInt("id");
                v.num  = item.itemdta.count;
                foreach (var it in list2)
                {
                    if (v.tpid == it.tpid)
                    {
                        it.num += item.itemdta.count;
                        return;
                    }
                }
                list2.Add(v);
            }
        }
예제 #12
0
        private void lvl_get_prize_res(Variant msgData)
        {
            //prize.Clear();
            bool b = GameRoomMgr.getInstance().onPrizeFinish(msgData);

            if (b)
            {
                return;
            }
            // Debug.LogError("KKKKK"+ msgData.dump());
            PVPRoom.instan?.refGet(msgData["ach_point"], msgData["exp"]);
            List <MapItemData> ld = new List <MapItemData>();

            if (msgData.ContainsKey("rewards"))
            {
                List <Variant> lv = msgData["rewards"]._arr;
                MapItemData    d;

                foreach (Variant v in lv)
                {
                    d       = new MapItemData();
                    d.count = v["cnt"];
                    d.id    = v["tpid"];
                    ld.Add(d);

                    //Rewards l = new Rewards();
                    //l.tpid = v["tpid"];
                    //l.cnt = v["cnt"];
                    //prize.Add(l);
                    //Debug.LogError(l.cnt);
                }
            }

            //if (PVPRoom.instan != null)
            //{

            // }

            //fb_win.lItemData = ld;
            // InterfaceMgr.getInstance().changeState(InterfaceMgr.STATE_FB_WIN);
            // GameCameraMgr.getInstance().useCamera("fb_win");
        }
예제 #13
0
        private void lvl_fin(Variant msgData)
        {
            this.reward.Clear();
            debug.Log("Fin Level ===============================" + msgData.dump());
            bool flag = msgData != null;

            if (flag)
            {
                bool flag2 = msgData["rewards"] != null;
                if (flag2)
                {
                    List <Variant> arr = msgData["rewards"]._arr;
                    foreach (Variant current in arr)
                    {
                        Rewards rewards = new Rewards();
                        rewards.tpid = current["tpid"];
                        rewards.cnt  = current["cnt"];
                        this.reward.Add(rewards);
                    }
                }
            }
            bool flag3 = GameRoomMgr.getInstance().onLevelFinish(msgData);

            if (!flag3)
            {
                bool flag4 = msgData.ContainsKey("ply_res");
                if (flag4)
                {
                    int  num   = msgData["ply_res"]._arr[0]["score"];
                    bool flag5 = num == 0;
                    if (flag5)
                    {
                        InterfaceMgr.getInstance().open(InterfaceMgr.FB_LOSE, null, false);
                    }
                }
                else
                {
                    BaseProxy <LevelProxy> .getInstance().sendLeave_lvl();
                }
            }
        }
예제 #14
0
        private void get_associate_lvls_res(Variant msgData)
        {
            int num  = msgData["res"];
            int num2 = num;

            if (num2 == 3)
            {
                int num3 = msgData["trig_id"];
                SceneCamera.CheckTrrigerCam(num3);
                bool flag = a3_trrigerDialog.instance != null;
                if (flag)
                {
                    a3_trrigerDialog.instance.CheckDialog(num3);
                }
            }
            bool flag2 = GameRoomMgr.getInstance().onLevelStatusChanges(msgData);

            if (!flag2)
            {
                NetClient.instance.dispatchEvent(GameEvent.Create(243u, this, GameTools.CreateSwitchData("get_associate_lvls_res", msgData), false));
            }
        }
예제 #15
0
        public void REV_RES_LIST_OK()
        {
            if (GameRoomMgr.getInstance().curRoom != null)
            {
                GameRoomMgr.getInstance().curRoom.clear();
            }
            //MediaClient.instance.clearMusic();
            NpcMgr.instance.clear();
            MonsterMgr._inst.clear();
            OtherPlayerMgr._inst.clear();
            if (tragethead.instance != null)
            {
                tragethead.instance.resetTragethead();
            }


            //LoaderBehavior.ms_HasAllLoaded = false;

            //if (m_map == null)
            //{
            //    setGraphImpl(g_mgr.createGraphMap(m_nCurMapSceneSettingID.ToString()));
            //    //_map = m_mgr.createGraphMap( mapid ) as IGRMap;
            //}
            //  m_map.loadConfig(m_CurLocalConf);

            //  Application.LoadLevelAdditive("p" + 101);


            if (m_curAssetBundleScene != null)
            {
                m_curAssetBundleScene.Unload(false);
                m_curAssetBundleScene = null;
            }


            //Application.LoadLevel(curSvrConf["name"]._str);


            //URLReqImpl urlreq_localver = new URLReqImpl();
            //urlreq_localver.dataFormat = "assetbundle";
            //urlreq_localver.url = "scene/" + curLocalConf["Mesh"]._arr[0]["asset"]._arr[0]["file"] + ".unity";
            //urlreq_localver.load((IURLReq local_r, object local_ret) =>
            //{
            //    //debug.Log("加载A3地图成功:" + local_r.url);
            //    //m_curAssetBundleScene = local_ret as AssetBundle;
            //    //if (initedDontDestory == false)
            //    //{
            //    //    UnityEngine.Object[] initsObjects = GameObject.FindObjectsOfType(typeof(GameObject));
            //    //    foreach (UnityEngine.Object go in initsObjects)
            //    //    {
            //    //        Application.DontDestroyOnLoad(go);
            //    //    }
            //    //    initedDontDestory = true;
            //    //}

            //    //Application.LoadLevel(m_nCurMapID.ToString());
            //},
            //  null,
            //  (IURLReq local_r, string err) =>
            //  {
            //    debug.Log("加载A3地图失败:" + err);
            //MediaClient.instance.clearMusic();
            DontDestroyBaseGameObject();
            GameEventTrigger.clear();
            debug.Log("开始加载地图");

            SceneFXMgr.StartLoadScene(curSvrConf["name"]._str);

            //SceneManager.LoadScene(curSvrConf["name"]._str);
            //GAMEAPI.Unload_Asset(curSvrConf["name"] + ".assetbundle");

            //if (debug.instance != null)
            //{
            //    debug.instance.LoadScene(curSvrConf["name"]._str);
            //}

            if (BaseRoomItem.instance != null)
            {
                BaseRoomItem.instance.clear();
            }

            if (a3_RollItem.single != null)
            {
                InterfaceMgr.getInstance().close(InterfaceMgr.A3_ROLL_ITEM);
            }

            //   });
            //if (login.instance == null)
            //    refreshLightMap();

            //m_nCurMapSceneSettingID = 0;
            //m_CurLocalConf = null;
        }
예제 #16
0
        private bool Execute(TaskData taskData, bool checkNextStep, bool checkItems, bool clickAuto)
        {
            if (taskData.taskT == TaskType.CLAN && A3_LegionModel.getInstance().myLegion.id == 0)
            {
                flytxt.instance.fly(ContMgr.getCont("a3_task_auto_nocy"));
                return(false);
            }
            //这里将任务的自动改成只读配置表(待测试)
            bool forceMove = taskData.next_step;

            if (forceMove || clickAuto)
            {
                if (SelfRole.fsm.Autofighting)
                {
                    SelfRole.fsm.Stop();
                    StateInit.Instance.Origin = Vector3.zero;
                }
            }
            else
            {
                return(false);
            }

            int npcId = 0;
            int mapId = 0;
            int posX  = 0;
            int posY  = 0;


            SXML taskXml = XMLMgr.instance.GetSXML("task.Task", "id==" + taskData.taskId);

            if (taskXml == null)
            {
                debug.Log("任务Id错误::" + taskData.taskId);
                return(false);
            }
            if (taskData.isComplete && taskData.taskT != TaskType.DAILY)
            {
                if (taskXml.getInt("complete_way") == 3)
                {
                    A3_TaskProxy.getInstance().SendGetAward();
                    return(true);
                }
                npcId = taskXml.getInt("complete_npc_id");
                SXML npcsXml = XMLMgr.instance.GetSXML("npcs.npc", "id==" + npcId);
                if (npcsXml != null)
                {
                    mapId = npcsXml.getInt("map_id");
                }
                List <string> listDialog = new List <string>();

                string strDialog = taskXml.getString("complete_dialog");
                strDialog = GameFramework.StringUtils.formatText(strDialog);
                string[] listTempDia = strDialog.Split(';');
                listDialog = listTempDia.ToList <string>();

                tarNpcId = npcId;
                //if(forceMove)
                //InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData
                //{
                //    mapId = mapId,
                //    check_beforeShow = true,
                //    handle_customized_afterTransmit = () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc)
                //});
                if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID)
                {
                    SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true), taskTrans: true);
                }
                else
                {
                    SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true);
                }
            }
            else
            {
                mapId = taskXml.getInt("tasking_map_id");
                posX  = taskXml.getInt("target_coordinate_x");
                posY  = taskXml.getInt("target_coordinate_y");
                float mapY = taskXml.getFloat("map_y");
                mapY = (mapY == -1 ? 0 : mapY);
                Vector3 pos = new Vector3(posX, mapY, posY);
                switch (taskData.targetType)
                {
                case TaskTargetType.DODAILY:     /*页面切换到每日任务*/
                    ArrayList arr          = new ArrayList();
                    var       tasks        = A3_TaskModel.getInstance().GetDicTaskData();
                    bool      hasDailyTask = false;
                    int       i            = 0;
                    for (List <int> idx = new List <int>(tasks.Keys); i < tasks.Count; i++)
                    {
                        if (hasDailyTask = tasks[idx[i]].taskT == TaskType.DAILY)
                        {
                            break;
                        }
                    }
                    if (hasDailyTask /*tasks.Count(v => v.Value.taskT == TaskType.DAILY) > 0*/)
                    {
                        List <int> k = tasks.Keys.ToList();
                        for (i = 0; i < k.Count; i++)
                        {
                            if (tasks[k[i]].taskT == TaskType.DAILY)
                            {
                                arr.Add(tasks[k[i]].taskId);
                            }
                        }
                        InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_TASK, arr);
                        //MonsterMgr._inst.taskMonId = XMLMgr.instance.GetSXML("task.Task", "id==" + taskData.taskId)?.getInt("target_param2") ?? 0;
                    }
                    break;

                case TaskTargetType.FRIEND:     /*关闭当前页面,弹出好友页面*/
                    if (a3_liteMinimap.instance)
                    {
                        a3_liteMinimap.instance.ZidongTask = false;
                    }
                    arr = new ArrayList();
                    arr.Add(1 /* index of friend panel*/);
                    InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_SHEJIAO, arr);
                    break;

                case TaskTargetType.WING:     /*关闭当前页面,弹出飞翼页面*/
                    if (a3_liteMinimap.instance)
                    {
                        a3_liteMinimap.instance.ZidongTask = false;
                    }
                    InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_WIBG_SKIN);
                    break;

                case TaskTargetType.GETEXP:    /*卡级任务、转生任务*/

                    debug.Log("当前是转生等级任务");
                    StateAutoMoveToPos.Instance.stopdistance = 0.3f;
                    int zs           = int.Parse(taskXml.getString("target_param2").Split(',')[0]);
                    int ls           = int.Parse(taskXml.getString("target_param2").Split(',')[1]);
                    int trriger_type = int.Parse(taskXml.getString("trigger"));
                    if (trriger_type == 1)
                    {
                        if (a3_liteMinimap.instance)
                        {
                            a3_liteMinimap.instance.ZidongTask = false;
                        }
                        InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_WANTLVUP);
                    }
                    else
                    {
                        bool b       = true;
                        int  pp      = PlayerModel.getInstance().profession;
                        uint pl      = PlayerModel.getInstance().lvl;
                        uint pz      = PlayerModel.getInstance().up_lvl;
                        uint exp     = PlayerModel.getInstance().exp;
                        uint needExp = ResetLvLModel.getInstance().getNeedExpByCurrentZhuan(pp, pz);
                        uint needLvL = ResetLvLModel.getInstance().getNeedLvLByCurrentZhuan(pp, pz);
                        if (pz >= 10)
                        {
                            break;              //10转之后无法再次转生
                        }
                        if (needLvL > pl)
                        {
                            b = false;
                        }
                        if (b)
                        {
                            npcId = XMLMgr.instance.GetSXML("task.zhuan_npc").getInt("id");
                            SXML npcsXml = XMLMgr.instance.GetSXML("npcs.npc", "id==" + npcId);
                            if (npcsXml != null)
                            {
                                mapId = npcsXml.getInt("map_id");
                            }

                            List <string> listDialog = new List <string>();

                            string strDialog = taskXml.getString("target_dialog");
                            strDialog = GameFramework.StringUtils.formatText(strDialog);
                            string[] listTempDia = strDialog.Split(';');
                            listDialog = listTempDia.ToList <string>();

                            //if (GRMap.instance != null)
                            //{
                            //    InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData
                            //    {
                            //        mapId = mapId,
                            //        check_beforeShow = true,
                            //        handle_customized_afterTransmit = () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc)
                            //    });
                            //}
                            if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID)
                            {
                                SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true), taskTrans: true);
                            }
                            else
                            {
                                SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true);
                            }
                            //InterfaceMgr.getInstance().open(InterfaceMgr.A3_RESETLVL);
                        }
                        else
                        {
                            if (a3_liteMinimap.instance)
                            {
                                a3_liteMinimap.instance.ZidongTask = false;
                            }
                            InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_WANTLVUP);
                        }
                    }
                    break;

                case TaskTargetType.VISIT:    /*访问(无条件)*/
                {
                    StateAutoMoveToPos.Instance.stopdistance = 2f;
                    npcId = taskXml.getInt("target_param2");
                    SXML npcsXml = XMLMgr.instance.GetSXML("npcs.npc", "id==" + npcId);
                    if (npcsXml != null)
                    {
                        mapId = npcsXml.getInt("map_id");
                    }

                    List <string> listDialog = new List <string>();
                    string        strDialog  = taskXml.getString("target_dialog");
                    strDialog = GameFramework.StringUtils.formatText(strDialog);
                    string[] listTempDia = strDialog.Split(';');
                    listDialog = listTempDia.ToList <string>();

                    tarNpcId = npcId;
                    if (GRMap.instance != null)
                    {
                        //InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData
                        //{
                        //    mapId = mapId,
                        //    check_beforeShow = true,
                        //    handle_customized_afterTransmit = () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc)
                        //});
                        if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID)
                        {
                            SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: () => SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true), taskTrans: true);
                        }
                        else
                        {
                            SelfRole.moveToNPc(mapId, npcId, listDialog, OnTalkWithNpc, taskmove: true);
                        }
                    }
                }
                break;

                case TaskTargetType.KILL:    /*杀怪类*/
                    //StateAutoMoveToPos.Instance.stopdistance = 2.0f;
                    SelfRole.UnderTaskAutoMove = true;
                    onTaskSearchMon            = taskData.taskT == TaskType.MAIN;
                    int _taskId;
                    if (PlayerModel.getInstance().task_monsterId.ContainsKey(taskData.taskId))
                    {
                        if (!PlayerModel.getInstance().task_monsterIdOnAttack.ContainsKey(taskData.taskId))
                        {
                            PlayerModel.getInstance().task_monsterIdOnAttack.Add(
                                key: taskData.taskId,
                                value: PlayerModel.getInstance().task_monsterId[taskData.taskId]
                                );
                        }
                        PlayerModel.getInstance().task_monsterId.Remove(taskData.taskId);
                        _taskId = taskData.taskId;
                    }
                    else
                    {
                        _taskId = A3_TaskModel.getInstance().GetTaskXML().GetNode("Task", "id==" + taskData.taskId).getInt("target_param2");
                        PlayerModel.getInstance().task_monsterIdOnAttack.Add(
                            key: taskData.taskId,
                            value: _taskId
                            );
                    }
                    SXML _taskXml = XMLMgr.instance.GetSXML("task.Task", "id==" + taskData.taskId);
                    //InterfaceMgr.getInstance().open(InterfaceMgr.TRANSMIT_PANEL, (ArrayList)new TransmitData
                    //{
                    //    mapId = mapId,
                    //    check_beforeShow = true,
                    //    handle_customized_afterTransmit = () =>
                    //    {
                    //        Vector3 fightOrigin = pos;
                    //        StateInit.Instance.Origin = fightOrigin;
                    //        SelfRole.moveto(mapId, pos, () =>
                    //        {
                    //            SelfRole.fsm.StartAutofight();
                    //            MonsterMgr._inst.taskMonId = _taskXml.getInt("target_param2");
                    //        }, stopDis: 2.0f);
                    //    }
                    //});
                    Action afterTransmit = () => {
                        Vector3 fightOrigin = pos;
                        StateInit.Instance.Origin = fightOrigin;
                        SelfRole.moveto(mapId, pos, () =>
                        {
                            SelfRole.fsm.StartAutofight();
                            MonsterMgr._inst.taskMonId = _taskXml.getInt("target_param2");
                        }, stopDis: 2.0f, taskmove: true);
                    };
                    if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID)
                    {
                        SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: afterTransmit, taskTrans: true);
                    }
                    else
                    {
                        SelfRole.WalkToMap(mapId, pos, afterTransmit, taskmove: true);
                    }
                    break;

                case TaskTargetType.COLLECT:

                    //Action afterTransmit_collect = () =>
                    //{
                    //    StateAutoMoveToPos.Instance.stopdistance = 0.3f;
                    //    SelfRole.moveto(mapId, pos, () => SelfRole.fsm.StartAutoCollect());
                    //};
                    Action afterTransmit_collect = () => SelfRole.WalkToMap(mapId, pos, SelfRole.fsm.StartAutoCollect, taskmove: true);
                    if (!PlayerModel.getInstance().inFb&& mapId != GRMap.instance.m_nCurMapID && MapModel.getInstance().dicMappoint.ContainsKey(mapId) && MapModel.getInstance().dicMappoint[mapId] != GRMap.instance.m_nCurMapID)
                    {
                        SelfRole.Transmit(toid: MapModel.getInstance().dicMappoint[mapId], after: afterTransmit_collect, taskTrans: true);
                    }
                    else
                    {
                        afterTransmit_collect();
                    }
                    break;

                case TaskTargetType.FB:
                    if (a3_liteMinimap.instance)
                    {
                        a3_liteMinimap.instance.ZidongTask = false;
                    }
                    int fbid = taskXml.getInt("target_param2");
                    //StateAutoMoveToPos.Instance.stopdistance = 0.3f;
                    if (GRMap.instance.m_nCurMapID == mapId || GameRoomMgr.getInstance().curRoom is PlotRoom)
                    {
                        SelfRole.moveto(mapId, pos, () => SelfRole.fsm.StartAutofight(), stopDis: 2.0f, taskmove: true /* 副本中开始战斗的停止距离 */);
                    }
                    else
                    {
                        Variant sendData = new Variant();
                        sendData["npcid"]    = 0;
                        sendData["ltpid"]    = fbid;
                        sendData["diff_lvl"] = 1;
                        int  levelinfoid = taskXml.getInt("level_info");
                        var  tainf       = XMLMgr.instance.GetSXML("task.level_info", "id==" + levelinfoid);
                        bool guide       = (taskXml.getInt("guide") == 1);
                        int  type        = taskXml.getInt("level_yw");
                        if (type == 1)
                        {
                            MsgBoxMgr.getInstance().showTask_fb_confirm(tainf.getString("title"), tainf.getString("desc"),
                                                                        guide, a3_ygyiwuModel.getInstance().GetYiWu_God(a3_ygyiwuModel.getInstance().nowGod_id).need_zdl, () => LevelProxy.getInstance().sendCreate_lvl(sendData));
                        }
                        else
                        {
                            MsgBoxMgr.getInstance().showTask_fb_confirm(tainf.getString("title"), tainf.getString("desc"),
                                                                        guide, () => LevelProxy.getInstance().sendCreate_lvl(sendData));
                        }
                    }
                    break;

                case TaskTargetType.WAIT_POINT_GIVEN:   /*在指定区域读条*/
                case TaskTargetType.GET_ITEM_GIVEN:     /*收集指定道具*/
                case TaskTargetType.KILL_MONSTER_GIVEN: /*打指定怪物*/
                    DealByType(taskData, checkItems);
                    break;
                }
                SXML _taskXML = XMLMgr.instance.GetSXML("task.Task", "id==" + taskData.taskId);
                if (SelfRole.UnderTaskAutoMove = taskData.targetType == TaskTargetType.KILL)
                {
                    StateAutoMoveToPos.Instance.stopdistance = 2.0f;
                    Vector3 fightOrigin = new Vector3(
                        x: _taskXML.getInt("target_coordinate_x"),
                        y: 0,
                        z: _taskXML.getInt("target_coordinate_y")
                        );
                    StateInit.Instance.Origin = fightOrigin;
                }
                if (taskData.targetType == TaskTargetType.KILL || taskData.targetType == TaskTargetType.DODAILY)
                {
                    int monId = _taskXML.getInt("target_param2");
                    if (monId != -1)
                    {
                        MonsterMgr._inst.taskMonId = monId;
                    }
                }
            }
            return(true);
        }
예제 #17
0
        public void move(Variant msgData)
        {
            //RoleMgr._instance.onMove(msgData);
            uint           iid = msgData["iid"]._uint;
            ProfessionRole pr  = OtherPlayerMgr._inst.GetOtherPlayer(iid);

            if (a3_insideui_fb.instance != null && PlayerModel.getInstance().inFb)
            {
                a3_insideui_fb.instance.Cancel();
            }
            if (pr != null)
            {
                float to_x = msgData["to_x"]._float / GameConstant.PIXEL_TRANS_UNITYPOS;
                float to_y = msgData["to_y"]._float / GameConstant.PIXEL_TRANS_UNITYPOS;

                Vector3 vec = new Vector3(to_x, pr.m_curModel.position.y, to_y);
                if (GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342])
                {//解决多层阻挡点寻路的问题
                    pr.SetDestPos(vec);
                }
                else
                {
                    NavMeshHit hit;

                    NavMesh.SamplePosition(vec, out hit, 100f, pr.m_layer);
                    pr.SetDestPos(hit.position);
                }
            }
            else
            {
                float       to_x = msgData["to_x"]._float / GameConstant.PIXEL_TRANS_UNITYPOS;
                float       to_y = msgData["to_y"]._float / GameConstant.PIXEL_TRANS_UNITYPOS;
                MonsterRole role = MonsterMgr._inst.getServerMonster(iid);
                if (role != null)
                {
                    Vector3 vec = new Vector3(to_x, role.m_curModel.position.y, to_y);
                    if (GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342] || GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3358])
                    {//解决多层阻挡点寻路的问题
                        role.SetDestPos(vec);
                    }
                    else
                    {
                        NavMeshHit hit;
                        NavMesh.SamplePosition(vec, out hit, 100f, role.m_layer);


                        role.SetDestPos(hit.position);
                    }
                }
            }



            //LGAvatarGameInst to = getRoleByIID(data["iid"]);
            //if (to == null) return;
            //to.addMoving(data);


            //Variant moveinfo = new Variant();
            //if (data == null || !data.ContainsKey("to_x"))
            //{
            //    GameTools.PrintError("addMoving err!");
            //    return;
            //}

            ////debug.Log("收到移动消息 " + data.dump());
            //float to_x = data["to_x"]._float / GameConstant.PIXEL_TRANS_UNITYPOS;
            //float to_y = data["to_y"]._float / GameConstant.PIXEL_TRANS_UNITYPOS;
            //debug.Log("收到移动消息 " + to_x + "  " + to_y);

            ////setMoveInfo(moveinfo);
        }
예제 #18
0
        private void lvl_fin(Variant msgData)
        {
            if (GameRoomMgr.getInstance().curRoom != null)
            {
                GameRoomMgr.getInstance().curRoom.clear();
            }

            //if (BaseRoomItem.instance != null ) {
            //    BaseRoomItem.instance.clearlist();
            //}
            reward.Clear();
            debug.Log("Fin Level ===============================" + msgData.dump());

            if (msgData != null)
            {
                if (msgData["rewards"] != null)
                {
                    List <Variant> l = msgData["rewards"]._arr;
                    foreach (var v in l)
                    {
                        Rewards d = new Rewards();
                        d.tpid = v["tpid"];
                        d.cnt  = v["cnt"];

                        reward.Add(d);
                    }
                }
                if (msgData.ContainsKey("item_drop"))
                {
                    List <Variant> l = msgData["item_drop"]._arr;
                    foreach (var v in l)
                    {
                        Rewards d = new Rewards();
                        d.tpid = v["tpid"];
                        d.cnt  = v["cnt"];
                        fbDrogward.Add(d);
                    }
                }

                //if (msgData.ContainsKey("kill_exp"))
                //{
                //    a3_fb_finish.allEXP = msgData["kill_exp"];//直接显示服务器发的数据
                //}
            }
            if (GameRoomMgr.getInstance().onLevelFinish(msgData))
            {
                return;
            }

            if (msgData.ContainsKey("ply_res"))
            {
                //int starNum = msgData["ply_res"]._arr[0]["score"];
                //if (starNum == 0)
                //    InterfaceMgr.getInstance().open(InterfaceMgr.FB_LOSE);
                //else
                //fb_win.star = starNum;
            }
            else
            {
                LevelProxy.getInstance().sendLeave_lvl();
            }
            //NetClient.instance.dispatchEvent(
            //     GameEvent.Create(PKG_NAME.S2C_LVL_FIN, this, GameTools.CreateSwitchData("on_lvl_fin", msgData))
            // );
            // GameSession(this.session).logicClient.logicInGame.lgGD_levels.on_lvl_fin(msgData);
        }
예제 #19
0
        private void a3_scene_loaded()
        {
            MapProxy.getInstance().changingMap = false;

            if (!grmap_loading)
            {
                return;
            }

            //   PlayerNameUIMgr.getInstance().Clear();

            //清空音效
            //MediaClient.instance.clearMusic();

            SceneCamera.Init();
            if (SelfRole._inst != null)
            {
                SelfRole._inst.dispose();
            }

            debug.Log("初始化角色");
            SelfRole.Init();

            SelfRole._inst.m_unIID             = PlayerModel.getInstance().iid;
            SelfRole._inst.m_curModel.position = PlayerModel.getInstance().enter_map_pos;
            SelfRole._inst.setNavLay(NavmeshUtils.listARE[1]);
            //debug.Log("地图加载后的坐标为" + SelfRole._inst.m_curModel.position);


            Time.fixedDeltaTime = 0.02f;

            GameObject svr = GameObject.Find("SVR_DATA");

            if (svr != null)
            {
                GameObject.Destroy(svr);
            }

            //主城添加一个z轴的18高度,防止初始化判断在阻挡外面。加了高度后虽然在阻挡外面,但hit返回的xy值正常,z值调整为正常
            float z = 0f;

            if (curSvrConf["id"] == 10 || GRMap.curSvrConf["id"] == 24)
            {
                z = 18f;
            }
            SelfRole._inst.setPos(new Vector3(PlayerModel.getInstance().mapBeginX, z, PlayerModel.getInstance().mapBeginY));

            if (PlayerModel.getInstance().mapBeginroatate > 0f)
            {
                SelfRole._inst.setRoleRoatate(PlayerModel.getInstance().mapBeginroatate);
                PlayerModel.getInstance().mapBeginroatate = 0f;
            }

            DoAfterMgr.instacne.addAfterRender(() =>
            {
                if (MapModel.getInstance().CheckAutoPlay())
                {
                    SelfRole.fsm.StartAutofight();
                }
            });


            GameRoomMgr.getInstance().onChangeLevel(curSvrConf, curSvrMsg);
            grmap_loading = false;

            if (!fristloaded)
            {
                if (showid.Contains(curSvrConf["id"]))
                {
                    InterfaceMgr.getInstance().close(InterfaceMgr.A3_PKMAPUI);
                }
                else
                {
                    if (curSvrConf.ContainsKey("pk_hint") && curSvrConf["pk_hint"] == 1)
                    {
                        InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_PKMAPUI);
                        showid.Add(curSvrConf["id"]);
                    }
                    else
                    {
                        InterfaceMgr.getInstance().close(InterfaceMgr.A3_PKMAPUI);
                    }
                }
            }
            //打开魔炼之地
            if (a3_fb_finish.ismlzd)
            {
                ArrayList dl = new ArrayList();
                dl.Add("mlzd");
                InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_ACTIVE, dl);
                a3_fb_finish.ismlzd = false;
            }
            if (curSvrConf.ContainsKey("pk_lock"))
            {
                InterfaceMgr.doCommandByLua("a1_low_fightgame.refreskCanPk", "ui/interfaces/low/a1_low_fightgame", false);
            }
            else
            {
                InterfaceMgr.doCommandByLua("a1_low_fightgame.refreskCanPk", "ui/interfaces/low/a1_low_fightgame", true);
            }

            if (a1_gamejoy.inst_skillbar != null)
            {
                if (GRMap.curSvrConf["id"] == 10 || GRMap.curSvrConf["id"] == 24)
                {
                    a1_gamejoy.inst_skillbar.ShowCombatUI(false);
                }
                else
                {
                    a1_gamejoy.inst_skillbar.ShowCombatUI(true);
                }
            }

            if (a3_liteMinimap.instance)
            {
                a3_liteMinimap.instance.refreshMapname();
            }
            InterfaceMgr.doCommandByLua("a1_high_fightgame.refreshMapname", "ui/interfaces/high/a1_high_fightgame", null);

            if (a1_gamejoy.inst_skillbar != null)
            {
                a1_gamejoy.inst_skillbar.refreshAllSkills(SelfRole.s_bStandaloneScene ? 0 : -1);
            }

            if (curSvrConf.ContainsKey("music"))
            {
                MediaClient.instance.PlayMusicUrl("audio_map_" + curSvrConf["music"], null, true);
            }

            fristloaded = false;

            OtherPlayerMgr._inst.onMapLoaded();
            MonsterMgr._inst.onMapLoaded();
            NpcMgr.instance.onMapLoaded();
            BattleProxy.getInstance().onMapLoaded();
        }