void dartHP(Variant data) { per = data["hp_per"]._int; dispatchEvent(GameEvent.Create(DARTHPNOW, this, data)); if (!gotoDart) { return; } if (data.ContainsKey("x")) { dartHave = true; float x = 0, z = 0; x = data["x"]._float / 53.3f; z = data["y"]._float / 53.3f; if (SelfRole._inst != null) { SelfRole.WalkToMap(data["map_id"], new Vector3(x, 2, z)); } } if (data["hp_per"]._int <= 20 && !showOne) { flytxt.instance.fly(ContMgr.getCont("clan_9")); showOne = true; } }
public override void init() { Instance = this; joinWorldInfo.instance.g_mgr.addEventListener(PKG_NAME.S2C_MAP_CHANGE, OnSceneChange); tfSkillbarCombat = a1_gamejoy.inst_skillbar.transform.FindChild("skillbar/combat"); goBeStronger = A3_BeStronger.Instance.gameObject; goUpBtn = goBeStronger.transform.FindChild("upbtn").gameObject; new BaseButton(transform.FindChild("openAuction")).onClick = OpenAuction; new BaseButton(transform.FindChild("go2warehouse")).onClick = MoveToWarehouseNPC; new BaseButton(transform.FindChild("go2treasureMap")).onClick = MoveToTreasureMapNPC; new BaseButton(getTransformByPath("gotoDart")).onClick = (GameObject go) => { SelfRole.moveToNPc((int)PlayerModel.getInstance().mapid, 1003); }; if (PlayerModel.getInstance().mapid == 10) { A3_BeStronger.Instance.Owner = Instance.transform; if (!goBeStronger.activeSelf) { goBeStronger.SetActive(true); goUpBtn.SetActive(A3_BeStronger.Instance.CheckUpItem()); } } else { gameObject.SetActive(false); } }
public override void Enter() { SelfRole._inst?.m_moveAgent?.ResetPath(); priority = SelfRole._inst.m_moveAgent.avoidancePriority; if (pos == Vector3.zero || Vector3.Distance(SelfRole._inst.m_curModel.position.ConvertToGamePosition(), pos.ConvertToGamePosition()) < stopdistance) { SelfRole._inst.m_moveAgent?.Stop(); handle?.Invoke(); SelfRole.fsm.ChangeState(StateIdle.Instance); return; } NavMeshHit hit; NavMesh.SamplePosition(pos, out hit, StateInit.Instance.Distance, NavmeshUtils.allARE); if (hit.position.x != Mathf.Infinity && hit.position.y != Mathf.Infinity && hit.position.z != Mathf.Infinity) { pos = hit.position; } SelfRole._inst.SetDestPos(pos); SelfRole._inst.m_curAni.SetBool(EnumAni.ANI_RUN, true); SelfRole.ChangeRideAniState(true); waitTick = 3; //SelfRole._inst.moving = true; }
public async Task AddRoleAsync(CommandContext context, DiscordRole role, string category = null) { var selfRoleCheck = await _databaseContext.SelfRoles .Where(r => r.GuildId == context.Guild.Id && r.RoleId == role.Id) .AnyAsync(); if (selfRoleCheck) { await context.RespondAsync($"**{role.Name}** is already a self assignable role."); return; } var selfRoleEntry = new SelfRole { Category = category, GuildId = context.Guild.Id, RoleId = role.Id }; _databaseContext.Add(selfRoleEntry); await _databaseContext.SaveChangesAsync(); await context.RespondAsync( $"**{role.Name}** is now self assignable in category {category ?? "default"}."); }
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); }
private void dartHP(Variant data) { this.per = data["hp_per"]._int; base.dispatchEvent(GameEvent.Create(4u, this, data, false)); bool flag = !this.gotoDart; if (!flag) { bool flag2 = data.ContainsKey("x"); if (flag2) { this.dartHave = true; float x = data["x"]._float / 53.3f; float z = data["y"]._float / 53.3f; bool flag3 = SelfRole._inst != null; if (flag3) { SelfRole.WalkToMap(data["map_id"], new Vector3(x, 2f, z), null, 0.3f); } } bool flag4 = data["hp_per"]._int <= 20 && !this.showOne; if (flag4) { flytxt.instance.fly(ContMgr.getCont("clan_9", null), 0, default(Color), null); this.showOne = true; } } }
void onMapClick(GameObject go, Vector2 mappos) { Vector2 pos2; if (RectTransformUtility.ScreenPointToLocalPointInRectangle(worldmap.instance.m_goMapcon.GetComponent <RectTransform>(), mappos, InterfaceMgr.ui_Camera_cam, out pos2)) { pos2 = Quaternion.Inverse(mapRotation) * pos2; Vector3 pos = SceneCamera.getPosByMiniMap(pos2, mapScale); if (pos.x == Mathf.Infinity) { return; } if (SelfRole.fsm.Autofighting) { SelfRole.fsm.Stop(); } SelfRole.moveto(pos, null); } //Vector3 offset = go.transform.position; //mappos.x = mappos.x - offset.x; //mappos.y = mappos.y - offset.y; //Vector3 pos = SceneCamera.getPosByMiniMap(mappos, mapScale); //if (pos.x == Mathf.Infinity) // return; //SelfRole.moveto(pos, null); }
public override void Exit() { SelfRole._inst.m_moveAgent.Stop(); SelfRole._inst.m_curAni.SetBool(EnumAni.ANI_RUN, false); SelfRole.ChangeRideAniState(false); SelfRole._inst.m_moveAgent.avoidancePriority = priority; //dropTimer = 0.0f; }
private void refredshPos() { if (line.Count == 0) { if (pos != Vector3.zero) { curtargetPos = pos; } else { SelfRole._inst.m_moveAgent.ResetPath(); SelfRole._inst.m_moveAgent.Stop(); if (handle != null) { handle(); } SelfRole.fsm.ChangeState(StateIdle.Instance); } return; } if (GRMap.instance.m_nCurMapID != line[0].mapid) { line.RemoveAt(0); curtargetPos = Vector3.zero; if (line.Count == 0) { curtargetPos = pos; if (curtargetPos == Vector3.zero) { return; } SelfRole._inst.SetDestPos(curtargetPos); SelfRole._inst.m_curAni.SetBool(EnumAni.ANI_RUN, true); SelfRole.ChangeRideAniState(true); waitTick = 3; } } if (curtargetPos == Vector3.zero) { curtargetPos = new Vector3(line[0].x, 0f, line[0].y); SelfRole._inst.SetDestPos(curtargetPos); SelfRole._inst.m_curAni.SetBool(EnumAni.ANI_RUN, true); SelfRole.ChangeRideAniState(true); waitTick = 5; } else { SelfRole._inst.m_curAni.SetBool(EnumAni.ANI_RUN, true); SelfRole.ChangeRideAniState(true); } }
public void refresh(List <SXML> list) { clear(); if (list.Count == 0) { return; } itemnum = 0; // int mapid = list[0].getInt("mapid"); // int lv_up = (int)PlayerModel.getInstance().up_lvl; //int lv = (int)PlayerModel.getInstance().lvl; for (int i = 0; i < list.Count; i++) { SXML xml = list[i]; if (xml.getInt("type") != type) { continue; } itemnum++; GameObject go = GameObject.Instantiate(tempItem) as GameObject; go.SetActive(true); go.transform.SetParent(transCon, false); go.transform.FindChild("Text").GetComponent <Text>().text = xml.getString("name"); go.name = xml.getString(xml.getString("id")); Button bt = go.GetComponent <Button>(); //bt.interactable = (lv_up > xml.getInt("lv_up")) || (lv_up == xml.getInt("lv_up") && lv >= xml.getInt("lv")); bt.onClick.AddListener(() => { if (worldmap.mapid == GRMap.instance.m_nCurMapID) { Vector3 vec = new Vector3(xml.getFloat("ux"), 0f, xml.getFloat("uy")); NavMeshHit hit; NavMesh.SamplePosition(vec, out hit, 20f, NavmeshUtils.allARE); SelfRole.moveto(hit.position, null); } else { Vector3 vec = new Vector3(xml.getFloat("ux"), 0f, xml.getFloat("uy")); SelfRole.moveto(worldmap.mapid, vec); } //这里处理点小地图切地图会乱寻路的bug,暂时没有好的办法 TransMapPoint.is_need_stop_fsm = true; //worldmapsubwin.mapid = worldmap.mapid; //worldmapsubwin.id = xml.getInt("id"); //InterfaceMgr.getInstance().open(InterfaceMgr.WORLD_MAP_SUB); }); } refreshScrollRect(); }
private void Update() { float deltaTime = Time.deltaTime; SceneCamera.FrameMove(); MonsterMgr._inst.FrameMove(deltaTime); SelfRole.FrameMove(deltaTime); TickMgr.instance.update(deltaTime); (CrossApp.singleton.getPlugin("gameEventDelegate") as gameEventDelegate).onProcess(deltaTime); }
public override void Exit() { SelfRole._inst.m_moveAgent.ResetPath(); SelfRole._inst.m_moveAgent.Stop(); SelfRole._inst.m_curAni.SetBool(EnumAni.ANI_RUN, false); SelfRole.ChangeRideAniState(false); collecting = false; SelfRole.fsm.AutoCollect = false; collTarget = null; }
void onfreeclick(GameObject go) { Vector3 vec = new Vector3(xml.getFloat("ux"), 0f, xml.getFloat("uy")); SelfRole.WalkToMap(vmap["id"], vec); InterfaceMgr.getInstance().close(InterfaceMgr.WORLD_MAP); InterfaceMgr.getInstance().close(InterfaceMgr.WORLD_MAP_SUB); if (a3_active.onshow) { InterfaceMgr.getInstance().close(InterfaceMgr.A3_ACTIVE); } }
private void petHas(Variant data) { debug.Log("宠物饲料到期:" + data.dump()); if (a3_new_pet.instance) { a3_new_pet.instance.havePet(null); } dispatchEvent(GameEvent.Create(EVENT_HAVE_PET, this, data)); if (SelfRole._inst != null) { SelfRole.showPet(data); } }
public override void init() { inText(); new BaseButton(this.transform.FindChild("go")).onClick = (GameObject go) => { SelfRole.fsm.Stop(); SelfRole.moveToNPc(10, npcId: 1001); InterfaceMgr.getInstance().close(InterfaceMgr.A3_BAOTUUI); }; new BaseButton(this.transform.FindChild("ok")).onClick = (GameObject go) => { InterfaceMgr.getInstance().close(InterfaceMgr.A3_BAOTUUI); }; }
private void onfreeclick(GameObject go) { Vector3 vec = new Vector3(this.xml.getFloat("ux"), 0f, this.xml.getFloat("uy")); SelfRole.WalkToMap(this.vmap["id"], vec, null, 0.3f); InterfaceMgr.getInstance().close(InterfaceMgr.WORLD_MAP); InterfaceMgr.getInstance().close(InterfaceMgr.WORLD_MAP_SUB); bool flag = a3_active.onshow; if (flag) { InterfaceMgr.getInstance().close(InterfaceMgr.A3_ACTIVE); } }
void onGo(GameObject go) { InterfaceMgr.getInstance().close(InterfaceMgr.A3_ACTIVE_GODLIGHT); if (MapModel.getInstance().dicMappoint?.ContainsKey(map_id) ?? false) { SelfRole.Transmit(MapModel.getInstance().dicMappoint[map_id], after: () => { SelfRole.moveto(map_id, new Vector3(map_x, 0, map_y), handle: () => { SelfRole.fsm.StartAutofight(); }); }); } }
public override void onClick() { //if (!A3_TaskModel.getInstance().IfCurrentCollectItem(monsterid)) // return; if (Vector3.Distance(m_curModel.transform.position, SelfRole._inst.m_curModel.transform.position) >= 0) { SelfRole.moveto(m_curModel.transform.position, () => { MapProxy.getInstance().sendCollectBox(m_unIID); cd.updateHandle = onCD2; cd.show(() => { m_curAni.SetBool("open", true); MapProxy.getInstance().sendStopCollectBox(false); InterfaceMgr.getInstance().close(InterfaceMgr.CD); }, collectTime, true, () => { MapProxy.getInstance().sendStopCollectBox(true); }); }, true, 1f); //InterfaceMgr.getInstance().close(InterfaceMgr.CD); } //else //{ // cd.updateHandle = onCD2; // cd.show(() => // { // MapProxy.getInstance().sendCollectBox(m_unIID); // // InterfaceMgr.getInstance().close(InterfaceMgr.CD); // }, // collectTime, true, // () => // { // MapProxy.getInstance().sendStopCollectBox(); // }); // InterfaceMgr.getInstance().close(InterfaceMgr.CD); //} }
void onClick() { string n = bt.gameObject.name.Substring(0, 1); if (n == "p") { /*worldmapsubwin.*/ int id = int.Parse(bt.gameObject.name.Substring(1, bt.gameObject.name.Length - 1)); //InterfaceMgr.getInstance().open(InterfaceMgr.WORLD_MAP_SUB); SelfRole.Transmit(toid: id); InterfaceMgr.getInstance().close(InterfaceMgr.WORLD_MAP); } else { worldmap.mapid = int.Parse(bt.gameObject.name); worldmap.instance.tab.setSelectedIndex(1); } }
private void Getpet(Variant data) { if (!PlayerModel.getInstance().havePet) { PlayerModel.getInstance().havePet = true;//刷新palyermodel里面数据是否有pet } debug.Log(data.dump()); A3_PetModel.getInstance().petId = data["pet"]["id_arr"]._arr; A3_PetModel.curPetid = (uint)data["pet"]["id"]._int; A3_PetModel.getInstance().Tpid = (uint)data["pet"]["id"]._int; dispatchEvent(GameEvent.Create(EVENT_GET_PET, this, data)); if (SelfRole._inst != null) { SelfRole.OnPetHaveChange(data); } }
public override void Exit() { if (SelfRole.fsm.previousState != this) { handle = null; line = null; pos = Vector3.zero; } curtargetPos = Vector3.zero; if (SelfRole._inst?.m_moveAgent == null) { return; } SelfRole._inst.m_moveAgent.ResetPath(); SelfRole._inst.m_moveAgent.Stop(); SelfRole._inst.m_curAni.SetBool(EnumAni.ANI_RUN, false); SelfRole.ChangeRideAniState(false); }
public override void onShowed() { #region 获取open参数 data = null; if (uiData.Count == 1) { data = (TransmitData)uiData[0]; } else { InterfaceMgr.getInstance().close(InterfaceMgr.TRANSMIT_PANEL); debug.Log("invalid uidata"); return; } #endregion if (data.check_beforeShow && !CheckPoint()) { if (data.handle_customized_afterTransmit != null) { data.handle_customized_afterTransmit(); } else if (data.targetPosition != Vector3.zero) { SelfRole.WalkToMap(dicMappoint[data.mapId], data.targetPosition, handle: data.after_arrive); } data.after_clickBtnWalk?.Invoke(); InterfaceMgr.getInstance().close(InterfaceMgr.TRANSMIT_PANEL); return; } #region 面板上的文字说明 bool isfree = PlayerModel.getInstance().vip >= 3; TargetMapId = data.mapId; SXML xml = XMLMgr.instance.GetSXML("mappoint.p", "id==" + dicMappoint[data.mapId]); Variant vmap = SvrMapConfig.instance.getSingleMapConf(xml.getUint("mapid")); string name = vmap.ContainsKey("map_name") ? vmap["map_name"]._str : "--"; int basecost = xml.getInt("cost"); curNeedMoney = basecost / 10 * (int)((float)PlayerModel.getInstance().lvl / 10) + basecost; textCostMoney.text = curNeedMoney.ToString(); textTargetDesc.text = name; gameObject.SetActive(true); #endregion transform.SetAsLastSibling(); }
public override void onClick() { if (!A3_TaskModel.getInstance().IfCurrentCollectItem(monsterid)) { return; } cd.hide(); if (Vector3.Distance(m_curModel.transform.position, SelfRole._inst.m_curModel.transform.position) > 2) { SelfRole.moveto(m_curModel.transform.position, () => { MapProxy.getInstance().sendCollectItem(m_unIID); cd.updateHandle = onCD; cd.show(() => { m_curAni.SetBool("open", true); MapProxy.getInstance().sendStopCollectItem(false); becollected = true; }, collectTime, true, () => { MapProxy.getInstance().sendStopCollectItem(true); }); }, true, 2f); } else { MapProxy.getInstance().sendCollectItem(m_unIID); cd.updateHandle = onCD; cd.show(() => { m_curAni.SetBool("open", true); MapProxy.getInstance().sendStopCollectItem(false); becollected = true; }, collectTime, true, () => { MapProxy.getInstance().sendStopCollectItem(true); }); } }
public void refresh(List <SXML> list) { this.clear(); bool flag = list.Count == 0; if (!flag) { this.itemnum = 0; for (int i = 0; i < list.Count; i++) { SXML xml = list[i]; bool flag2 = xml.getInt("type") != this.type; if (!flag2) { this.itemnum++; GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.tempItem); gameObject.SetActive(true); gameObject.transform.SetParent(this.transCon, false); gameObject.transform.FindChild("Text").GetComponent <Text>().text = xml.getString("name"); gameObject.name = xml.getString(xml.getString("id")); Button component = gameObject.GetComponent <Button>(); component.onClick.AddListener(delegate { bool flag3 = worldmap.mapid == GRMap.instance.m_nCurMapID; if (flag3) { Vector3 sourcePosition = new Vector3(xml.getFloat("ux"), 0f, xml.getFloat("uy")); NavMeshHit navMeshHit; NavMesh.SamplePosition(sourcePosition, out navMeshHit, 20f, NavmeshUtils.allARE); SelfRole.moveto(navMeshHit.position, null, false, 0.3f, true); } else { Vector3 pos = new Vector3(xml.getFloat("ux"), 0f, xml.getFloat("uy")); SelfRole.moveto(worldmap.mapid, pos, null, 0.3f); } }); } } this.refreshScrollRect(); } }
private void onMapClick(GameObject go, Vector2 mappos) { Vector2 vector; bool flag = RectTransformUtility.ScreenPointToLocalPointInRectangle(worldmap.instance.m_goMapcon.GetComponent <RectTransform>(), mappos, InterfaceMgr.ui_Camera_cam, out vector); if (flag) { vector = Quaternion.Inverse(this.mapRotation) * vector; Vector3 posByMiniMap = SceneCamera.getPosByMiniMap(vector, this.mapScale, 20f); bool flag2 = posByMiniMap.x == float.PositiveInfinity; if (!flag2) { bool autofighting = SelfRole.fsm.Autofighting; if (autofighting) { SelfRole.fsm.Stop(); } SelfRole.moveto(posByMiniMap, null, false, 0.3f, true); } } }
public override void Exit() { if (SelfRole._inst.m_moveAgent != null) { SelfRole._inst.m_moveAgent.avoidancePriority = priority; } if (SelfRole.fsm.previousState != this) { //handle = null; pos = Vector3.zero; } handle = null; try { SelfRole._inst?.m_moveAgent?.Stop(); SelfRole._inst?.m_curAni?.SetBool(EnumAni.ANI_RUN, false); SelfRole.ChangeRideAniState(false); lastStay = SelfRole._inst.m_curModel.transform.position.ConvertToGamePosition(); } catch (Exception) { lastStay = Vector3.zero; } stopdistance = 0.3f; //SelfRole._inst.moving = false; }
public override void Execute(float delta_time) { if (waitTick > 0) { waitTick--; return; } if (MapProxy.getInstance().changingMap) { return; } if (SelfRole._inst?.m_moveAgent == null) { return; } refredshPos(); if (waitTick > 0) { waitTick--; return; } SelfRole._inst.m_curAni?.SetBool(EnumAni.ANI_RUN, true); SelfRole.ChangeRideAniState(true); if (line.Count == 0) { Vector3 v = SelfRole._inst.m_moveAgent.destination.ConvertToGamePosition(); float dis = Vector3.Distance(SelfRole._inst.m_curModel.position.ConvertToGamePosition(), v);//SelfRole._inst.m_moveAgent.remainingDistance; if (dis <= SelfRole.fsm.StopDistance) { SelfRole._inst?.m_moveAgent?.ResetPath(); SelfRole._inst?.m_moveAgent?.Stop(); if (handle != null) { handle(); } SelfRole.fsm.ChangeState(StateIdle.Instance); return; } thinktime += delta_time; if (thinktime > 1) { thinktime = 0; if (dis < 5f) { Quaternion rot = Quaternion.LookRotation(SelfRole._inst.m_curModel.forward - pos.normalized); if (rot.eulerAngles.y > 10f) { SelfRole._inst?.TurnToPos(pos); } } } } }
void sczghd_go(GameObject go) { InterfaceMgr.getInstance().close(InterfaceMgr.A3_WANTLVUP); SelfRole.moveto(map_id, new Vector3(map_x, 0, map_y)); }
internal void <init> b__7_0(GameObject go) { SelfRole.moveToNPc((int)ModelBase <PlayerModel> .getInstance().mapid, 1003, null, null); }
public override void init() { instance = this; textCostMoney = transform.FindChild("bt1/cost").GetComponent <Text>(); textTargetDesc = transform.FindChild("desc").GetComponent <Text>(); new BaseButton(transform.FindChild("bt0")).onClick = (GameObject go) => { if (data.handle_customized_afterTransmit != null) { data.handle_customized_afterTransmit(); } else if (data.targetPosition != Vector3.zero) { SelfRole.WalkToMap(data.mapId, data.targetPosition, handle: data.after_arrive); } data.after_clickBtnWalk?.Invoke(); InterfaceMgr.getInstance().close(InterfaceMgr.TRANSMIT_PANEL); }; new BaseButton(transform.FindChild("bt1")).onClick = (GameObject go) => { if (PlayerModel.getInstance().vip < 3 && PlayerModel.getInstance().money < curNeedMoney) { flytxt.instance.fly(ContMgr.getCont("comm_nomoney")); return; } if (SelfRole.fsm.Autofighting) { SelfRole.fsm.Stop(); } if (data.closeWinName != null) { for (int i = 0; i < data.closeWinName.Length; i++) { InterfaceMgr.getInstance().close(data.closeWinName[i]); } } SelfRole.Transmit(toid : dicMappoint[data.mapId], after : delegate() { if (data.handle_customized_afterTransmit != null) { data.handle_customized_afterTransmit(); } else if (data.targetPosition != Vector3.zero) { SelfRole.WalkToMap(data.mapId, data.targetPosition, handle: data.after_arrive); } }); data.after_clickBtnTransmit?.Invoke(); InterfaceMgr.getInstance().close(InterfaceMgr.TRANSMIT_PANEL); }; new BaseButton(transform.FindChild("btclose")).onClick = (GameObject go) => { InterfaceMgr.getInstance().close(InterfaceMgr.TRANSMIT_PANEL); }; dicMappoint = new Dictionary <int, int>(); List <SXML> listMappoint = XMLMgr.instance.GetSXML("mappoint").GetNodeList("trans_remind"); for (int i = 0; i < listMappoint.Count; i++) { int mapId, transId; if ((mapId = listMappoint[i].getInt("map_id")) != -1 && (transId = listMappoint[i].getInt("trance_id")) != -1) { dicMappoint.Add(mapId, 1 + transId * 100); } } getComponentByPath <Text>("desc").text = ContMgr.getCont("worldmapsubwin_0"); getComponentByPath <Text>("bt0/Text").text = ContMgr.getCont("worldmapsubwin_1"); getComponentByPath <Text>("Text").text = ContMgr.getCont("worldmapsubwin_2"); }