public uint Execute(PacketDistributed ipacket) { GC_Building_LevelUp packet = (GC_Building_LevelUp )ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic if (packet.Ret == 0) { PlayerProxy proxy = GameFacade.GetProxy <PlayerProxy> (); for (int i = 0; i < proxy.city.buildList.Count; i++) { BuildingVo buildingData = proxy.city.buildList[i]; if (buildingData.guid == packet.BuildingID) { buildingData.level = packet.Level; EventManager.GetInstance().SendEvent(EventId.BuildingLevelUp, buildingData.guid); break; } } } return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
public void OnInit() { if (View == null) { Game.StartCoroutine(GameAssets.LoadAssetAsync <GameObject>(BattleUIView.BundleName, BattleUIView.AssetName, (prefab) => { var ins = Object.Instantiate(prefab); Utils.StandardizeObject(ins); if (View == null) { View = ins.GetComponent <BattleUIView>(); } AddListener(); var troopList = GameFacade.GetProxy <BattleProxy>().BattleInfor.objList.Where(item => item.skilldataid != null && item.skilldataid.Any()).Select(item => item.id).ToList(); for (int i = 0; i < troopList.Count; i++) { SkillIndexToTroopIndex.Add(i, troopList[i]); } IsInited = true; })); GameAssets.AddBundleRef(BattleUIView.BundleName); } else { IsInited = true; } }
public void ReceiveSendMarch(object parm) { LogModule.DebugLog("ReceiveSendMarch"); CSendMarch tSendMarch = GameFacade.GetProxy <BattleProxy>().SendMarch; mSceneID = tSendMarch.sceneId; }
public void RefreshData() { CityMediator cityMediator = GameFacade.GetMediator <CityMediator>(); List <Tab_CityBuildingDefault> defaults = TableManager.GetCityBuildingDefaultByID(cityMediator.curSlotType); Tab_CityBuildingDefault building = defaults[0]; PlayerProxy proxy = GameFacade.GetProxy <PlayerProxy> (); cityID = building.Id; cityName = building.Name; Dictionary <int, List <Tab_CityBuildingLevel> > dict = TableManager.GetCityBuildingLevel(); List <Tab_CityBuildingLevel> levels = TableManager.GetCityBuildingLevelByID(cityID); for (int i = 0; i < proxy.city.buildList.Count; i++) { var data = proxy.city.buildList[i]; if (data.type == cityID) { cityLevel = data.level; } } EventManager.GetInstance().SendEvent("Private_RefreshCityInfoBase"); }
public void DoClickOnTile(Coord c) { MapTileVO mt = GameFacade.GetProxy <MapProxy>().GetTile(c); _clickAnimationing = true; Vector3 prePos = MapCamera.transform.localPosition; Vector3 lookPos = prePos + (Layout.HexCenter(c) - Layout.ScreenPos2WorldPos(MapCamera, MapInfoHighlightPos)); GoTweenConfig config = new GoTweenConfig(); FloatCallbackTweenProterty ftpy = new FloatCallbackTweenProterty(0, 1, delegate(float obj) { MoveCamera(Vector3.Lerp(prePos, lookPos, obj)); }); config.addTweenProperty(ftpy); config.onCompleteHandler = delegate(AbstractGoTween go) { _clickAnimationing = false; }; ShowHighLight(Layout.HexCenter(c)); Go.to(MapCamera.transform, 0.5f, config); if (onClickHandler != null) { onClickHandler(c); } }
//Seed All void OnMRBAction_Common() { MapTileVO tile = mapProxy.GetTile(mDst); ModifyVOByOp(tile); GameFacade.GetProxy <MapProxy>().SeedTile(tile); }
void OnGUI() { if (GUILayout.Button("ReqAllMarch")) { GameFacade.GetProxy <WorldProxy>().SendQuestAllMarch(); } }
public void ReceiveBattleInfor(object parm) { LogModule.DebugLog("ReceiveBattlerInfor"); CBattleInfor tBattleInfor = GameFacade.GetProxy <BattleProxy>().BattleInfor; mCurrentCamp = (SquadCamp)tBattleInfor.camp; ServerBattleState tServerBattleState = (ServerBattleState)tBattleInfor.currentState; if (tServerBattleState == ServerBattleState.STATUS_SELECTTARGET || tServerBattleState == ServerBattleState.STATUS_MARCH || tServerBattleState == ServerBattleState.STATUS_COMBAT) { mBattleState = BattleState.Start; } else { mBattleState = BattleState.prepare; } if (mSceneID != tBattleInfor.sceneId) { return; } StartCoroutine(LoadUnitAssets(tBattleInfor)); //Open Battle UI. MediatorManager.GetInstance().Add(new BattleUIController()); }
Mesh CreateHexagonMeshWithoutUVColor() { Mesh mesh = new Mesh(); mesh.name = "Hexagon"; List <Vector3> vertices = new List <Vector3>(); List <int> triangles = new List <int>(); for (int col = 0; col < width; ++col) { for (int row = 0; row < height; ++row) { Coord local = new Coord(col, row); Coord world = new Coord(col + xMin, row + yMin); MapTileVO tileVo = GameFacade.GetProxy <MapProxy>().GetTile(world); if (tileVo != null) { AddHexagonVertices(vertices, triangles, layout.HexCenter(local)); } } } mesh.vertices = vertices.ToArray(); mesh.triangles = triangles.ToArray(); return(mesh); }
private void BuildingLevelUp(object id) { long guid = (long)id; PlayerProxy proxy = GameFacade.GetProxy <PlayerProxy> (); for (int i = 0; i < proxy.city.buildList.Count; i++) { BuildingVo buildingData = proxy.city.buildList [i]; if (buildingData.guid == guid) { for (int j = 0; j < buildings.Count; j++) { if (buildings [j].guid == guid) { buildings [j].level = buildingData.level; EventManager.GetInstance().SendEvent("Private_RefreshBuildingLevel", guid); break; } } break; } } }
public void LoadSquad(object parm) { if (mSceneID == -1) { mSceneID = GameFacade.GetProxy <WorldProxy>().FightInfor.sceneId; } GetBattlerInfor(); }
public void SendMerch(object parm) { long tMarrchID = GameFacade.GetProxy <PlayerProxy>().marchList[0].marchId; CG_SEND_MARCH objListPacket = (CG_SEND_MARCH)PacketDistributed.CreatePacket(MessageID.PACKET_CG_SEND_MARCH); objListPacket.SetMarchid(tMarrchID); objListPacket.SendPacket(); }
public void ShowMarks(MapEditorEntry.EDIT_OP op, Color[] color) { if (mMarks == null) { mMarks = new SpriteRenderer[hex.xTile][]; } for (int x = 0; x < hex.xTile; ++x) { if (mMarks[x] == null) { mMarks[x] = new SpriteRenderer[hex.yTile]; } for (int y = 0; y < hex.yTile; ++y) { Coord c = new Coord(x + hex.xTile * xIdx, y + hex.yTile * yIdx); if (mapProxy == null) { mapProxy = GameFacade.GetProxy <MapProxy>(); } MapTileVO tileVo = mapProxy.GetTile(c); if (tileVo != null) { int index; if (op == MapEditorEntry.EDIT_OP.EDIT_AREA) { index = tileVo.camp; } else if (op == MapEditorEntry.EDIT_OP.EDIT_LV) { index = tileVo.level; } else { Debug.LogError("Error Op."); return; } if (index >= color.Length) { Debug.LogError("No defined color of this index."); return; } SpriteRenderer mark; if (mMarks[x][y] != null) { mMarks[x][y].color = color[index]; continue; } mark = GetAMark(); mark.color = color[index]; mark.transform.localPosition = layout.HexCenter(tileVo.coord) - transform.localPosition; mark.transform.localScale = new Vector3(1.5f, 1.55f, 1f); mark.transform.localEulerAngles = new Vector3(90f, 0f, 0f); mMarks[x][y] = mark; } } } markRoot.gameObject.SetActive(true); }
int GetMatNameInd(int thisCoordX, int thisCoordY, int neighborInd) { MapProxy mapProxy = GameFacade.GetProxy <MapProxy>(); if (neighborInd > 5 || neighborInd < 0) { Coord thisCoord = new Coord(thisCoordX, thisCoordY); byte thisMat = mapProxy.GetTile(thisCoord).mat; if (thisMat == 8) { thisMat = 0; } int thisMatNameNum = thisSprites[thisMat]; spriteIds[0] = thisMatNameNum; return(0); } Coord c_neighbor = GetNeighborCoord(thisCoordX, thisCoordY, neighborInd); MapTileVO t_neighbor = mapProxy.GetTile(c_neighbor); if (t_neighbor == null) { return(-1); } byte m_neighbor = t_neighbor.mat; if (m_neighbor == 8) { m_neighbor = 0; } int neighborMatNameNum = -1; int neighborMatNameInd = -1; switch (neighborInd) { default: case 4: neighborMatNameNum = leftSprites[m_neighbor]; spriteIds[1] = neighborMatNameNum; neighborMatNameInd = 1; break; case 2: neighborMatNameNum = prevSprites[m_neighbor]; spriteIds[2] = neighborMatNameNum; neighborMatNameInd = 2; break; case 3: neighborMatNameNum = diagSprites[m_neighbor]; spriteIds[3] = neighborMatNameNum; neighborMatNameInd = 3; break; } return(neighborMatNameInd); }
private void SetProxy(GC_LOGIN_RET packet) { PlayerProxy proxy = GameFacade.GetProxy <PlayerProxy>(); proxy.userid = packet.Userid; proxy.oid = packet.Oid; proxy.accesstoken = packet.Accesstoken; proxy.playername = packet.Playername; proxy.level = packet.Level; //城市数据 proxy.city.cityId = packet.City.CityId; proxy.city.tileId = packet.City.TileId; proxy.city.level = packet.City.Level; proxy.city.food = packet.City.Food; proxy.city.stone = packet.City.Stone; proxy.city.iron = packet.City.Iron; proxy.city.WorldPos = new Coord(packet.City.Posx, packet.City.Posz); proxy.city.buildList.Clear(); for (int i = 0; i < packet.City.buildlistCount; i++) { GC_BuildingData data = packet.City.GetBuildlist(i); BuildingVo vo = new BuildingVo(); PlayerProxy.SetBuildVo(data, vo); proxy.city.buildList.Add(vo); } proxy.city.trainList.Clear(); for (int i = 0; i < packet.City.trainListCount; i++) { GC_TrainData data = packet.City.GetTrainList(i); TrainVo vo = new TrainVo(); PlayerProxy.SetTrainVo(data, vo); proxy.city.trainList.Add(vo); } //英雄数据 proxy.heroList.Clear(); for (int i = 0; i < packet.HeroList.heroListCount; i++) { GC_HeroData data = packet.HeroList.GetHeroList(i); HeroVo vo = new HeroVo(); PlayerProxy.SetHeroVo(data, vo); proxy.heroList.Add(vo); } //队伍数据 proxy.marchList.Clear(); for (int i = 0; i < packet.Marchlist.marchlistCount; i++) { GC_MarchData data = packet.Marchlist.GetMarchlist(i); MarchVo vo = new MarchVo(); PlayerProxy.SetMarchVo(data, vo); proxy.marchList.Add(vo); } }
// guid 建筑ID type 建筑类型 slot 建筑位置 level 建筑等级 public void PlayerProxyUpdate(object obj) { PlayerProxy proxy = GameFacade.GetProxy <PlayerProxy> (); cityLevel = proxy.city.level; food = proxy.city.food; stone = proxy.city.stone; iron = proxy.city.iron; if (proxy.city.buildList.Count != 0) { for (int i = 0; i < proxy.city.buildList.Count; i++) { BuildingData data = new BuildingData(); data.guid = proxy.city.buildList [i].guid; data.type = proxy.city.buildList [i].type; data.slot = proxy.city.buildList [i].slot; data.level = proxy.city.buildList [i].level; //建筑基本信息 List <Tab_CityBuildingDefault> cityBuilding = TableManager.GetCityBuildingDefaultByID(data.type); data.buildName = cityBuilding[0].Name; data.isUpgrade = (cityBuilding[0].IsUpgrade == 0)?false:true; data.maxLevel = cityBuilding[0].MaxLevel; //建筑等级信息 List <Tab_CityBuildingLevel> levelList = TableManager.GetCityBuildingLevelByID(data.type); for (int n = 0; n < levelList.Count; n++) { if (levelList [n].Level == data.level) { Tab_CityBuildingLevel cityBuildingLevel = levelList [n]; data.description = cityBuildingLevel.Description; data.asset = cityBuildingLevel.Asset; data.bundle = cityBuildingLevel.Bundle; data.prosperity = cityBuildingLevel.Prosperity; for (int j = 0; j < cityBuildingLevel.getNeedBuildingCount(); j++) { data.needBuildingID.Add(cityBuildingLevel.GetNeedBuildingbyIndex(j)); } data.needTime = cityBuildingLevel.NeedTime; data.needFood = cityBuildingLevel.NeedFood; data.needStone = cityBuildingLevel.NeedStone; data.needIron = cityBuildingLevel.NeedIron; data.needGold = cityBuildingLevel.NeedGold; break; } } buildings.Add(data); } } // view.UpdateAllData (buildings); }
public void GetFightInfor(int tAimMarchID) { LogModule.DebugLog("Send Get Fight Infor!"); CG_FIGHT fight = (CG_FIGHT)PacketDistributed.CreatePacket(MessageID.PACKET_CG_FIGHT); fight.SetType(1); fight.SetAttackId(GameFacade.GetProxy <PlayerProxy>().marchList[0].marchId); fight.SetDefenceId(tAimMarchID); fight.SetSceneId(mSceneID); fight.SendPacket(); }
int GetMatNameInd(int thisCoordX, int thisCoordY, int neighborInd) { MapProxy mapProxy = GameFacade.GetProxy <MapProxy>(); if (neighborInd > 5 || neighborInd < 0) { Coord thisCoord = new Coord(thisCoordX, thisCoordY); byte thisMat = mapProxy.GetTile(thisCoord).mat; if (thisMat == 8) { thisMat = 0; } int thisMatNameNum = thisSprites[thisMat]; int thisMatNameInd = FindInSpriteIds(spriteIds, thisMatNameNum); return(thisMatNameInd); } Coord c_neighbor = GetNeighborCoord(thisCoordX, thisCoordY, neighborInd); MapTileVO t_neighbor = mapProxy.GetTile(c_neighbor); if (t_neighbor == null) { return(-1); } byte m_neighbor = t_neighbor.mat; if (m_neighbor == 8) { m_neighbor = 0; } int neighborMatNameNum = -1; if (neighborInd == 4) { neighborMatNameNum = leftSprites[m_neighbor]; } else { if (thisCoordY % 2 == 0) { neighborMatNameNum = leftSprites[m_neighbor]; } else { neighborMatNameNum = thisSprites[m_neighbor]; } } int neighborMatNameInd = FindInSpriteIds(spriteIds, neighborMatNameNum); return(neighborMatNameInd); }
int GetNeighborHeight(int thisCoordX, int thisCoordY, int neighborInd) { int height_neighbor = -1; Coord c_neighbor = GetNeighborCoord(thisCoordX, thisCoordY, neighborInd); MapProxy mapProxy = GameFacade.GetProxy <MapProxy>(); MapTileVO t_neighbor = mapProxy.GetTile(c_neighbor); if (t_neighbor != null) { height_neighbor = t_neighbor.height; } return(height_neighbor); }
public void UpdateSprList() { if (mapProxy == null) { mapProxy = GameFacade.GetProxy <MapProxy>(); } List <int> sprs = mapProxy.GetSprLists(xIdx, yIdx); mHexBg.spriteIds.Clear(); mHexBg.spriteIds.AddRange(sprs); mHexWater.spriteIds.Clear(); mHexWater.spriteIds.AddRange(sprs); }
public uint Execute(PacketDistributed ipacket) { GC_OBJPREPAREFORATTACK packet = (GC_OBJPREPAREFORATTACK )ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic BattleProxy proxy = GameFacade.GetProxy <BattleProxy>(); BattleProxy.SetPrepareForAttackInfor(proxy.PrepareForAttackInfor, packet); EventManager.GetInstance().SendEvent(EventId.ReceivePrepareForAttack, packet); return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
public uint Execute(PacketDistributed ipacket) { GC_OBJGETHURT packet = (GC_OBJGETHURT )ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic BattleProxy proxy = GameFacade.GetProxy <BattleProxy>(); BattleProxy.SetObjectGetHurt(proxy.ObjectGetHurt, packet); EventManager.GetInstance().SendEvent(EventId.ReceiveObjGetHurt, packet); return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
public uint Execute(PacketDistributed ipacket) { GC_OBJCOMMANDPURSUE packet = (GC_OBJCOMMANDPURSUE )ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } BattleProxy proxy = GameFacade.GetProxy <BattleProxy>(); BattleProxy.SetPursueInfor(proxy.PursueInfor, packet); EventManager.GetInstance().SendEvent(EventId.ReceiveCommandPursue, packet); //enter your logic return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
public uint Execute(PacketDistributed ipacket) { GC_BATTLEINFOR packet = (GC_BATTLEINFOR )ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic BattleProxy proxy = GameFacade.GetProxy <BattleProxy>(); BattleProxy.SetBattleInfor(proxy.BattleInfor, packet); EventManager.GetInstance().SendEvent(EventId.ReceiveBattleInfor, packet); return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
public uint Execute(PacketDistributed ipacket) { GC_RET_USE_SKILL packet = (GC_RET_USE_SKILL )ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic BattleProxy proxy = GameFacade.GetProxy <BattleProxy>(); BattleProxy.SetUseSkill(proxy.UseSkill, packet); EventManager.GetInstance().SendEvent(EventId.ReceiveSkill, packet); return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
public uint Execute(PacketDistributed ipacket) { GC_OBJPOSLIST packet = (GC_OBJPOSLIST )ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic BattleProxy proxy = GameFacade.GetProxy <BattleProxy>(); BattleProxy.SetCurrentObjPos(proxy.CurrentObjPos, packet); EventManager.GetInstance().SendEvent(EventId.ReceiveSquadPosInfor, packet); return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
public uint Execute(PacketDistributed ipacket) { GC_TroopTrain_Over packet = (GC_TroopTrain_Over )ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic if (packet.Ret == 0) { int queueIndex = -1; PlayerProxy proxy = GameFacade.GetProxy <PlayerProxy> (); for (int i = 0; i < proxy.city.trainList.Count; i++) { if (proxy.city.trainList[i].queueid == packet.Queueid) { queueIndex = proxy.city.trainList [i].queueIndex; proxy.city.trainList.RemoveAt(i); } } //设置队伍中的单位信息 for (int i = 0; i < proxy.marchList.Count; i++) { if (proxy.marchList[i].buildId == packet.Buildid) { List <TroopVo> list = proxy.marchList [i].troopList; for (int j = 0; j < list.Count; j++) { if (list[j].queueIndex == queueIndex) { list [j].health = packet.Hp; } } } } EventManager.GetInstance().SendEvent(EventId.TroopTrainOver, null); } else { UnityEngine.Debug.Log("数据包报错了!!!"); } return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
public void InitMarchData() { for (int i = 0; i < GameFacade.GetProxy <PlayerProxy>().marchList.Count; i++) { MyMarchList.Add(new MarchInfo() { Name = "MyMarch" + i, State = "采集中", Time = new TimeHelper.ClockTime(29336), Position = new Coord(10 + i, 10 + i), MarchData = GameFacade.GetProxy <PlayerProxy>().marchList[i], IsOut = false }); } //Set temp data. //for (int i = 0; i < 1; i++) //{ // OtherMarchList.Add(new MarchInfo() { Name = "TestOtherMarch" + i, Position = new Coord(5 + i, 8 + i) }); //} SendQuestAllMarch(); }
public void ReceiveCommandPursue(object parm) { LogModule.DebugLog("ReceiveCommandPursue"); if (mBattleState != BattleState.prepare && mBattleState != BattleState.Start) { LogModule.DebugLog("AssetNotOk"); return; } CPursueInfor tPursueInfor = GameFacade.GetProxy <BattleProxy>().PursueInfor; if (mSceneID != tPursueInfor.sceneId) { return; } Vector3 tAimPos = mSquadGameObjDict[tPursueInfor.aimObjId].transform.position; SquadController tAimController = mSquadGameObjDict[tPursueInfor.aimObjId].transform.GetComponent <SquadController>(); //mSquadGameObjDict[tObjCommandPursue.ObjId].GetComponent<SquadController>().SquadAttackEnemy(tAimController); //mSquadGameObjDict[tObjCommandPursue.ObjId].GetComponent<SquadController>().UnitMarching(tAimPos); }
public void ReceiveSkill(object parm) { LogModule.DebugLog("ReceiveSkill"); if (mBattleState != BattleState.prepare && mBattleState != BattleState.Start) { LogModule.DebugLog("AssetNotOk"); return; } CUseSkill tSkill = GameFacade.GetProxy <BattleProxy>().UseSkill; if (mSceneID != tSkill.sceneId) { return; } SquadController sender = mSquadGameObjDict[tSkill.senderId].transform.GetComponent <SquadController>(); Transform receiver = mSquadGameObjDict[tSkill.targetId].transform; sender.CastSkill(receiver); }