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(); } }
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(); } } } } }