private void createMapNpcs() { if (SelfRole.s_bStandaloneScene) { return; } joinWorldInfo jinfo = this.g_mgr.g_netM.getObject(OBJECT_NAME.DATA_JOIN_WORLD) as joinWorldInfo; Variant pinfo = jinfo.mainPlayerInfo; uint mapid = jinfo.mapid; Variant conf = ( this.g_mgr.g_gameConfM.getObject(OBJECT_NAME.CONF_SERVER_MAP) as SvrMapConfig ).getSingleMapConf(mapid); if (conf == null || !conf.ContainsKey("n")) { return; } Variant npcs = conf["n"]; foreach (Variant n in npcs._arr) { int nid = int.Parse(n["nid"]); Variant npc = ( this.g_mgr.g_gameConfM.getObject(OBJECT_NAME.CONF_SERVER_NPC) as SvrNPCConfig ).get_npc_data(nid); if (npc == null) { //DebugTrace.print( "map[ "+mapid+" ] npc[ "+nid +" ] no data ERR!" ); continue; } LGAvatarNpc ct = new LGAvatarNpc(this.g_mgr); _npcs[nid.ToString()] = ct; if (npc.ContainsKey("defdid")) { ct.dialogId = npc["defdid"]; } Variant info = new Variant(); info["x"] = n["x"]._int / GameConstant.GEZI_TRANS_UNITYPOS; info["y"] = n["y"]._int / GameConstant.GEZI_TRANS_UNITYPOS; info["nid"] = n["nid"]; info["name"] = npc["name"]; info["octOri"] = n["r"]; ct.initData(info); ct.init(); } }
public void enter_lvl(Variant data) { debug.Log("SCENE_LEVEL ---- 收到服务器创建完副本的消息,开始准备资源播放剧情,地图ID为" + data["mapid"]); Variant variant = SvrLevelConfig.instacne.get_level_data(data["ltpid"]); bool flag = variant != null; if (flag) { joinWorldInfo joinWorldInfo = this.g_mgr.g_netM.getObject("DATA_JOIN_WORLD") as joinWorldInfo; joinWorldInfo.m_data["mpid"] = variant["map"][0]["id"]; MapModel.getInstance().curLevelId = data["ltpid"]._uint; InterfaceMgr.doCommandByLua("MapModel:getInstance().getcurLevelId", "model/MapModel", new object[] { data["ltpid"]._uint }); MapModel.getInstance().curDiff = data["diff_lvl"]._uint; GRMap.LEVEL_PLOT_ID = data["ltpid"]._int; debug.Log("!!sendRPC(PKG_NAME.C2S_ENTER_LVL_RES, data)2!!"); base.sendRPC(242u, data); LGLoadResource._instance.m_nLoaded_MapID = -1; } else { MapModel.getInstance().curLevelId = 0u; InterfaceMgr.doCommandByLua("MapModel:getInstance().getcurLevelId", "model/MapModel", new object[] { 0 }); debug.Log("!!sendRPC(PKG_NAME.C2S_ENTER_LVL_RES, data)2!!"); base.sendRPC(242u, data); LGLoadResource._instance.m_nLoaded_MapID = -1; } }
private Variant refreshMapInfo() { joinWorldInfo joinWorldInfo = this.g_mgr.g_netM.getObject("DATA_JOIN_WORLD") as joinWorldInfo; Variant mainPlayerInfo = joinWorldInfo.mainPlayerInfo; this._currMapid = joinWorldInfo.mapid; Variant value = this.currMapLocalConf(); Variant variant = this.currMapSvrConf(); bool flag = variant != null; if (flag) { this._tile_size = variant["tile_size"]; this.m_unMapWidth = variant["width"]; this.m_unMapHeight = variant["height"]; this._globaMapW = variant["width"] * this._tile_size; this._globaMapH = variant["height"] * this._tile_size; } Variant variant2 = new Variant(); Variant variant3 = new Variant(); variant2["param"] = variant3; variant3["width"] = this._globaMapW; variant3["height"] = this._globaMapH; Variant variant4 = new Variant(); variant4["localConf"] = value; variant4["conf"] = variant; variant4["mapid"] = this._currMapid; variant4["tmpLinks"] = this._tmpLinks; return(variant4); }
public void enter_lvl(Variant data) { debug.Log("SCENE_LEVEL ---- 收到服务器创建完副本的消息,开始准备资源播放剧情,地图ID为" + data["mapid"]); //debug.Log(data.dump()); //jason请求进入副本,要加载副本所有的相关的资源 //通过level_id 来找到mapid ,预先加载好地图 //sendData["mapid"] = curmapid; //sendData["ltpid"] = ltpid; Variant xml = SvrLevelConfig.instacne.get_level_data(data["ltpid"]); if (xml != null) { joinWorldInfo jinfo = this.g_mgr.g_netM.getObject(OBJECT_NAME.DATA_JOIN_WORLD) as joinWorldInfo; //这里的mapid是对应gconf中的mapid jinfo.m_data["mpid"] = xml["map"][0]["id"]; /************修改有时进地图副本时游戏卡住的bug * (调试下来是进副本的协议和播放剧情的模块逻辑冲突问题,解决方案:屏蔽掉剧情播放)***********/ //LGLoadResource._instance.m_nLoaded_MapID = -1; //LGLoadResource._instance._onMapChgLoad(); //MapModel.getInstance().curLevelId = data["ltpid"]._uint; //GRMap.LEVEL_PLOT_ID = data["ltpid"]._int; ////sendRPC(PKG_NAME.C2S_ENTER_LVL_RES, data); //GRMap.SetPoltOver_EnterLevel(delegate () //{ // debug.Log("SCENE_LEVEL ---- 剧情播放完毕,进入地图" + jinfo.m_data["mpid"]); // debug.Log("!!sendRPC(PKG_NAME.C2S_ENTER_LVL_RES, data)1!!" + " " + debug.count); // sendRPC(PKG_NAME.C2S_ENTER_LVL_RES, data); // LGLoadResource._instance.m_nLoaded_MapID = jinfo.m_data["mpid"]; //}); MapModel.getInstance().curLevelId = data["ltpid"]._uint; InterfaceMgr.doCommandByLua("MapModel:getInstance().getcurLevelId", "model/MapModel", data["ltpid"]._uint); MapModel.getInstance().curDiff = data["diff_lvl"]._uint; GRMap.LEVEL_PLOT_ID = data["ltpid"]._int; debug.Log("!!sendRPC(PKG_NAME.C2S_ENTER_LVL_RES, data)2!!"); sendRPC(PKG_NAME.C2S_ENTER_LVL_RES, data); LGLoadResource._instance.m_nLoaded_MapID = -1; } else { MapModel.getInstance().curLevelId = 0; InterfaceMgr.doCommandByLua("MapModel:getInstance().getcurLevelId", "model/MapModel", 0); debug.Log("!!sendRPC(PKG_NAME.C2S_ENTER_LVL_RES, data)2!!"); sendRPC(PKG_NAME.C2S_ENTER_LVL_RES, data); LGLoadResource._instance.m_nLoaded_MapID = -1; } }
private Variant refreshMapInfo() { joinWorldInfo jinfo = this.g_mgr.g_netM.getObject(OBJECT_NAME.DATA_JOIN_WORLD) as joinWorldInfo; Variant pinfo = jinfo.mainPlayerInfo; _currMapid = jinfo.mapid; //todo map conf Variant localConf = currMapLocalConf(); Variant conf = currMapSvrConf(); if (conf != null) { _tile_size = conf["tile_size"]; m_unMapWidth = conf["width"]; m_unMapHeight = conf["height"]; _globaMapW = conf["width"] * _tile_size; _globaMapH = conf["height"] * _tile_size; } //_pause = false; Variant mcale = new Variant(); Variant param = new Variant(); mcale["param"] = param; param["width"] = _globaMapW; param["height"] = _globaMapH; //gridData //short[] grd = (this.g_mgr.g_gameConfM as muCLientConfig).localGrd.grd; //_mapCalc.changeMap(mcale, grd); //refreshCameraParma(); // formatXY(pinfo["x"], pinfo["y"]); Variant einfo = new Variant(); einfo["localConf"] = localConf; einfo["conf"] = conf; einfo["mapid"] = _currMapid; einfo["tmpLinks"] = _tmpLinks; return(einfo); }
private void createMapNpcs() { bool s_bStandaloneScene = SelfRole.s_bStandaloneScene; if (!s_bStandaloneScene) { joinWorldInfo joinWorldInfo = this.g_mgr.g_netM.getObject("DATA_JOIN_WORLD") as joinWorldInfo; Variant mainPlayerInfo = joinWorldInfo.mainPlayerInfo; uint mapid = joinWorldInfo.mapid; Variant singleMapConf = (this.g_mgr.g_gameConfM.getObject("SvrMap") as SvrMapConfig).getSingleMapConf(mapid); bool flag = singleMapConf == null || !singleMapConf.ContainsKey("n"); if (!flag) { Variant variant = singleMapConf["n"]; foreach (Variant current in variant._arr) { int npcid = int.Parse(current["nid"]); Variant variant2 = (this.g_mgr.g_gameConfM.getObject("SvrNPC") as SvrNPCConfig).get_npc_data(npcid); bool flag2 = variant2 == null; if (!flag2) { LGAvatarNpc lGAvatarNpc = new LGAvatarNpc(this.g_mgr); this._npcs[npcid.ToString()] = lGAvatarNpc; bool flag3 = variant2.ContainsKey("defdid"); if (flag3) { lGAvatarNpc.dialogId = variant2["defdid"]; } Variant variant3 = new Variant(); variant3["x"] = (float)current["x"]._int / 1.666f; variant3["y"] = (float)current["y"]._int / 1.666f; variant3["nid"] = current["nid"]; variant3["name"] = variant2["name"]; variant3["octOri"] = current["r"]; lGAvatarNpc.initData(variant3); lGAvatarNpc.init(); } } } } }
public joinWorldInfo(muNetCleint m) : base(m) { instance = this; }