private void on_map_dpitem_res(Variant msg_data) { debug.Log("!!!!!!!!!!on_map_dpitem_res!" + msg_data.dump()); float x = msg_data["x"]._float / 53.333f; float z = msg_data["y"]._float / 53.333f; bool flag = msg_data.ContainsKey("owner_see"); if (flag) { bool flag2 = msg_data["owner_see"] != ModelBase <PlayerModel> .getInstance().cid; if (flag2) { return; } } Vector3 pos = new Vector3(x, 0f, z); List <Variant> arr = msg_data["itms"]._arr; List <DropItemdta> list = new List <DropItemdta>(); long curServerTimeStampMS = NetClient.instance.CurServerTimeStampMS; foreach (Variant current in arr) { DropItemdta dropItemdta = new DropItemdta(); dropItemdta.init(current, curServerTimeStampMS); list.Add(dropItemdta); } bool flag3 = BaseRoomItem.instance != null; if (flag3) { BaseRoomItem.instance.showDropItem(pos, list, false); } }
public void onChangeLevel(Variant svrconf, Variant cursvrmsg) { bool flag = this.curRoom != null; if (flag) { this.curRoom.onEnd(); this.curRoom = null; } uint key = svrconf["id"]; bool flag2 = this.dRooms.ContainsKey(key); if (flag2) { this.curRoom = this.dRooms[key]; } else { bool flag3 = MapModel.getInstance().curLevelId > 0u; if (flag3) { this.curRoom = this.dRooms[9999999u]; } else { this.curRoom = this.dRooms[0u]; } } this.curRoom.onStart(svrconf); bool flag4 = cursvrmsg != null && cursvrmsg.ContainsKey("dpitms"); if (flag4) { List <Variant> arr = cursvrmsg["dpitms"]._arr; Dictionary <string, List <DropItemdta> > dictionary = new Dictionary <string, List <DropItemdta> >(); long curServerTimeStampMS = NetClient.instance.CurServerTimeStampMS; foreach (Variant current in arr) { int num = current["x"]; int num2 = current["y"]; string key2 = num + "+" + num2; bool flag5 = !dictionary.ContainsKey(key2); if (flag5) { dictionary[key2] = new List <DropItemdta>(); } DropItemdta dropItemdta = new DropItemdta(); dropItemdta.init(current, curServerTimeStampMS); dropItemdta.x = num; dropItemdta.y = num2; dictionary[key2].Add(dropItemdta); } foreach (List <DropItemdta> current2 in dictionary.Values) { Vector3 pos = new Vector3((float)current2[0].x / 53.333f, 0f, (float)current2[0].y / 53.333f); BaseRoomItem.instance.showDropItem(pos, current2, false); } } }
//地图掉落金币 private void on_map_dpitem_res(Variant msg_data) { // BaseRoomItem.instance.showDropItem(); // DropItemdta debug.Log("!!!!!!!!!!on_map_dpitem_res!" + msg_data.dump()); float x = msg_data["x"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; float y = msg_data["y"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; if (msg_data.ContainsKey("owner_see")) { if (msg_data["owner_see"] != PlayerModel.getInstance().cid) { return; } } Vector3 pos = new Vector3(x, 0f, y); List <Variant> l = msg_data["itms"]._arr; List <DropItemdta> lDropItm = new List <DropItemdta>(); long timer = NetClient.instance.CurServerTimeStampMS; foreach (Variant v in l) { DropItemdta d = new DropItemdta(); d.init(v, timer); lDropItm.Add(d); } if (BaseRoomItem.instance != null) { BaseRoomItem.instance.showDropItem(pos, lDropItm); } }
public void onChangeLevel(Variant svrconf, Variant cursvrmsg) { if (curRoom != null) { curRoom.onEnd(); curRoom = null; } // debug.Log("!!!!:::::::::::"+cursvrmsg.dump()); //skillbar.setAutoFightType(0); uint curId = svrconf["id"]; if (dRooms.ContainsKey(curId)) { curRoom = dRooms[curId]; } else if (MapModel.getInstance().curLevelId > 0) { curRoom = dRooms[9999999]; } else { curRoom = dRooms[0]; } curRoom.onStart(svrconf); if (cursvrmsg != null && cursvrmsg.ContainsKey("dpitms")) { List <Variant> dps = cursvrmsg["dpitms"]._arr; Dictionary <string, List <DropItemdta> > ll = new Dictionary <string, List <DropItemdta> >(); long curtimer = NetClient.instance.CurServerTimeStampMS; foreach (Variant v in dps) { int x = v["x"]; int y = v["y"]; string strpos = x + "+" + y; if (!ll.ContainsKey(strpos)) { ll[strpos] = new List <DropItemdta>(); } DropItemdta d = new DropItemdta(); d.init(v, curtimer); d.x = x; d.y = y; ll[strpos].Add(d); } foreach (List <DropItemdta> l in ll.Values) { Vector3 ve = new Vector3((float)l[0].x / GameConstant.PIXEL_TRANS_UNITYPOS, 0f, (float)l[0].y / GameConstant.PIXEL_TRANS_UNITYPOS); BaseRoomItem.instance.showDropItem(ve, l); } } //if (curId == 0) //{ // if (skillbar.instance != null) // { // skillbar.instance.autifight.visiable = false; // } // InterfaceMgr.getInstance().close(InterfaceMgr.MONSTER_DICT); // InterfaceMgr.getInstance().changeState(InterfaceMgr.STATE_NORMAL); // return; //} //if (expbar.instance != null) //{ // skillbar.instance.autifight.visiable = true; //} //SXML xml = XMLMgr.instance.GetSXML("worldcfg.world", "level_id==" + MapModel.getInstance().curLevelId); //bool b = xml.hasFound; //if (xml.hasFound) //{ // skillbar.setAutoFightType(); // InterfaceMgr.getInstance().open(InterfaceMgr.MONSTER_DICT); // InterfaceMgr.getInstance().changeState(InterfaceMgr.STATE_FB_BATTLE); //} //else if (dRooms.ContainsKey(curId)) //{ // dRooms[curId].onStart(); // curRoom = dRooms[curId]; //} //MapProxy.getInstance().sendShowMapObj(); }