private void CreateTestPvp() { SlgPB.PVPUser pvp = new SlgPB.PVPUser(); SlgPB.UnitGroup unitGroup = new SlgPB.UnitGroup(); pvp.unitGroups.Add(unitGroup); unitGroup.posId = 1; unitGroup.unitId = 1; unitGroup.num = 10; unitGroup.heroId = 2; SlgPB.Hero pbHero = new SlgPB.Hero(); pvp.heroes.Add(pbHero); pbHero.heroId = 2; pbHero.exp = 100; pbHero.stage = 1; SlgPB.Unit pbUnit = new SlgPB.Unit(); pvp.units.Add(pbUnit); pbUnit.unitId = 1; pbUnit.unitPartLevel.Add(1); pbUnit.unitPartLevel.Add(1); pbUnit.unitPartLevel.Add(1); pbUnit.unitPartLevel.Add(1); InstancePlayer.instance.pvpUser = pvp; }
public void Parse(SlgPB.UnitGroup unitGroup) { unitId = unitGroup.unitId; num = unitGroup.num; heroId = unitGroup.heroId; if (unitId > 0) { isEmpty = false; } }
public SlgPB.UnitGroup ConvertSlgPBUnitGroup() { SlgPB.UnitGroup SlgPB_UnitGroup = new SlgPB.UnitGroup(); SlgPB_UnitGroup.teamId = teamId; SlgPB_UnitGroup.posId = posId; SlgPB_UnitGroup.unitId = unitId; SlgPB_UnitGroup.num = num; SlgPB_UnitGroup.heroId = heroId; return(SlgPB_UnitGroup); }
public void ImportFromPvp(SlgPB.PVPUser pvpUser) { InitPvpDataMap(pvpUser); mission = new DataMission(); mission.asset = DataMission.BK_NAMES [(int)RandomHelper.Range(0, DataMission.BK_NAMES.Length)]; extraTeamCount = 1; enemyTeams = new InstanceTeam[extraTeamCount]; friendTeams = new InstanceTeam[extraTeamCount]; InstanceTeam instanceTeam = new InstanceTeam(); instanceTeam.units = new InstanceUnitPvp[DataConfig.FORMATION_TOTAL_SLOT]; int memberCount = pvpUser.unitGroups.Count; for (int i = 0; i < memberCount; ++i) { SlgPB.UnitGroup group = pvpUser.unitGroups [i]; int unitId = group.unitId; int unitCount = group.num; int heroId = group.heroId; float powerScale = 1; if (unitId > 0 && unitCount > 0) { SlgPB.Hero pbHero = null; if (pbHeroesMap.ContainsKey(heroId)) { pbHero = pbHeroesMap [heroId]; } SlgPB.Unit pbUnit = null; if (pbUnitsMap.ContainsKey(unitId)) { pbUnit = pbUnitsMap [unitId]; } InstanceUnitPvp instanceUnitPvp = new InstanceUnitPvp(false, heroId, unitId, unitCount, powerScale, pbHero, pbUnit); instanceUnitPvp.Init(); int slotId = group.posId - 1; instanceTeam.units[slotId] = instanceUnitPvp; } } enemyTeams [0] = instanceTeam; }
public void CreateUnitGroupsResquest(List <SlgPB.UnitGroup> requestUnitGroups) { for (int i = 0; i < TEAM_COUNT; ++i) { for (int j = 0; j < POSITION_COUNT; ++j) { Model_UnitGroup model_UnitGroup = _formations[i][j]; SlgPB.UnitGroup SlgPB_UnitGroup = model_UnitGroup.ConvertSlgPBUnitGroup(); requestUnitGroups.Add(SlgPB_UnitGroup); // Trace.trace ("client formation " + " teamId " +model_UnitGroup.teamId + " posId " + model_UnitGroup.posId + " unitId " + // model_UnitGroup.unitId + " heroId " + model_UnitGroup.heroId, Trace.CHANNEL.IO); } } }