Example #1
0
    private void Start()
    {
        Debug.Log("开始Demo");
        Debug.Log("开始....加载xml数据...............");
        new URLReqImpl
        {
            dataFormat = "binary",
            url        = "staticdata/staticdata.dat"
        }.load(delegate(IURLReq url_req, object ret)
        {
            Debug.Log("demo 加载数据xml...............");
            byte[] d            = ret as byte[];
            ByteArray byteArray = new ByteArray(d);
            byteArray.uncompress();
            XMLMgr.instance.init(byteArray);
        }, null, delegate(IURLReq url_req, string err)
        {
            Debug.Log("加载staticdata 失败。。。。。。。。。。。。" + url_req.url);
        });
        Globle.Init_DEFAULT();
        Globle.A3_DEMO = true;
        Application.targetFrameRate = 60;
        new CrossApp(true);
        CrossApp.singleton.regPlugin(new gameEventDelegate());
        CrossApp.singleton.regPlugin(new processManager());
        Screen.SetResolution(Screen.width, Screen.height, true);
        SceneCamera.Init();
        SelfRole.Init();
        Variant variant = new Variant();

        variant["id"]         = 1;
        GRMap.changeMapTimeSt = 7;
        GRMap.loading         = false;
        GameRoomMgr.getInstance().onChangeLevel(variant, null);
    }
Example #2
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();
        }