public override void onShowed() { ResetLvLProxy.getInstance().addEventListener(ResetLvLProxy.EVENT_RESETLVL, onResetLvLSucc); lab_fightingCapacityValue.text = PlayerModel.getInstance().combpt.ToString(); lab_level.text = ContMgr.getCont("a3_resetlvl_lv", new List <string>() { PlayerModel.getInstance().up_lvl.ToString(), PlayerModel.getInstance().lvl.ToString() }); profession = PlayerModel.getInstance().profession; zhuan = PlayerModel.getInstance().up_lvl; uint lvl = PlayerModel.getInstance().lvl; uint exp = ResetLvLModel.getInstance().getExpByResetLvL(profession, zhuan, lvl); uint currentExp = PlayerModel.getInstance().exp > ResetLvLModel.getInstance().getAllExpByZhuan(profession, zhuan)?ResetLvLModel.getInstance().getAllExpByZhuan(profession, zhuan):PlayerModel.getInstance().exp; lab_experience.text = string.Format("{0}/{1}", currentExp, ResetLvLModel.getInstance().getAllExpByZhuan(profession, zhuan));// 玩家经验/当前转等级经验 sliderExperience.maxValue = ResetLvLModel.getInstance().getAllExpByZhuan(profession, zhuan); sliderExperience.value = PlayerModel.getInstance().exp; statusPointStr = ResetLvLModel.getInstance().getAwardAttrPointByZhuan(profession, zhuan).ToString(); createNum(uint.Parse(statusPointStr)); lab_waradEquip.text = getAwardDescStr(zhuan); lab_consumeGolds.text = ResetLvLModel.getInstance().getNeedGoldsByZhuan(profession, zhuan).ToString(); lab_consumeGolds.color = getGoldsColor(); txt_currentZhuan.sprite = GAMEAPI.ABUI_LoadSprite("icon_resetlvl_" + zhuan); // zhuan.ToString()+"转"; txt_targetZhuan.sprite = GAMEAPI.ABUI_LoadSprite("icon_resetlvl_" + (zhuan + 1)); //(zhuan + 1).ToString() + "转"; nextZhuanLvl.text = ContMgr.getCont("a3_resetlvl_lv", new List <string>() { (zhuan + 1).ToString(), ResetLvLModel.getInstance().getNextLvLByZhuan(profession, zhuan, currentExp).ToString() }); createAvatar(); btn_description.addEvent(); btn_reincarnation.addEvent(); btn_close.addEvent(); touchBG.addEvent(); }
void onReincarnationClick(GameObject go) { uint needGolds = ResetLvLModel.getInstance().getNeedGoldsByZhuan(profession, zhuan); if (needGolds > PlayerModel.getInstance().money) { InterfaceMgr.getInstance().close(InterfaceMgr.A3_RESETLVL); flytxt.instance.fly(ContMgr.getCont("comm_nomoney")); InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_GETGOLDWAY); } else { //向服务器发转生消息 ResetLvLProxy.getInstance().sendResetLvL(); } }
private bool isCanResetLvL(int pp, uint pl, uint pz, uint exp) { uint needExp = ResetLvLModel.getInstance().getNeedExpByCurrentZhuan(pp, pz); uint needLvL = ResetLvLModel.getInstance().getNeedLvLByCurrentZhuan(pp, pz); if (needLvL > pl) { return(false); } if (pz >= 10) { return(false); //10转之后无法再次转生 } //if (needExp > exp) return false;//TODO:暂时不做判断 return(true); }
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); }
Color getGoldsColor() { uint needGolds = ResetLvLModel.getInstance().getNeedGoldsByZhuan(profession, zhuan); return(needGolds > PlayerModel.getInstance().money ? Color.red:Color.green); }