protected void AddAttack(Tile Tile, SingleAttackOrder NewAttack) { AttackOrder attack = null; if (_AttackBuilder == null || _AttackBuilder.TargetTile != Tile || !_AttackBuilder.IsCompatible(NewAttack)) { attack = NewAttack.GenerateNewAttackOrder(); } else { attack = _AttackBuilder; } var r = attack.AddAttacker(NewAttack); if (r == OrderInvalidReason.NONE) { if (attack != _AttackBuilder) { _AttackBuilder = attack; var attackPane = new AttackPane(_AttackBuilder); attackPane.OnClose = CloseWindow; attackPane.OnAttackTargetChanged += ChangeAttackTarget; attackPane.OnExecute += ExecuteAttack; _Controller.SetPane(attackPane); } } else { _Controller.Alert(r); } }
private void btnAddOrder_Click(object sender, EventArgs e) { AttackOrder order = new AttackOrder(); DateTime time = dtpArrivle.Value; int ms = (int)numMs.Value; time = time.AddMilliseconds(-time.Millisecond + ms); order.StartLocation = ucStartVillageSelector.SelectedVillage.Location; order.TargetLocation = ucTargetVillageSelector.SelectedVillage.Location; order.UnitId = (int)cbSlowestUnit.SelectedValue; order.Comment = txtNote.Text; m_AttackHandler.CurrentAttackPlan.AttackOrders.Add(order); //attackOrderBindingSource.Add(order); if (rbSend.Checked) { order.SendTime = time; } else if (rbArrivle.Checked) { order.ArrivleTime = time; } }
void CreateNewOrder(Point position) { var selectedItem = (ListBoxItem)orderTypeListBox.SelectedItem; var orderTypeName = (string)selectedItem.Content; IOrder newOrder; switch (orderTypeName) { case "Attack": newOrder = new AttackOrder(0, 0); break; case "Guard": //newOrder = new GuardOrder(0, 0); break; case "Repair": //newOrder = new RepairOrder(0, 0); break; default: throw new Exception("Ordertype not expected: " + orderTypeName); } //action.Orders.Add(newOrder); }
public AttackPane(AttackOrder Attack) : base("attack-pane") { this.Attack = Attack; Attack.OnChanged += UpdateDescription; _CloseButton.Position = new Vector2f(Size.X - _CloseButton.Size.X - LeftPadding.X * 2, 0); _CloseButton.OnClick += HandleClose; foreach (var target in Enum.GetValues(typeof(AttackTarget)).Cast <AttackTarget>()) { _AttackTargetSelect.Add(new SelectionOption <AttackTarget>("attack-target-select-option") { DisplayedString = ObjectDescriber.Describe(target), Value = target }); } _AttackTargetSelect.SetValue(i => i.Value == Attack.Target); _AttackTargetSelect.OnChange += HandleAttackTargetChanged; _OrderButton.Position = new Vector2f(0, Size.Y - _OrderButton.Size.Y - 32); _OrderButton.OnClick += (sender, e) => { if (OnExecute != null) { OnExecute(this, EventArgs.Empty); } }; _Description.Position = new Vector2f(0, _AttackTargetSelect.Size.Y + 24); Add(_CloseButton); Add(_Description); Add(_AttackTargetSelect); Add(_OrderButton); UpdateDescription(null, EventArgs.Empty); }
private void btnSnipe_Click(object sender, EventArgs e) { VillageList list = (VillageList)villageListsBindingSource.Current; if (list == null) { return; } foreach (VillageInfo startVill in list.Villages) { AttackOrder order = new AttackOrder(); DateTime time = dtpArrivle.Value; int ms = (int)numMs.Value; time = time.AddMilliseconds(-time.Millisecond + ms); order.StartLocation = startVill.Location; order.TargetLocation = ucTargetVillageSelector.SelectedVillage.Location; order.UnitId = (int)cbSlowestUnit.SelectedValue; order.Comment = txtNote.Text; m_AttackHandler.CurrentAttackPlan.AttackOrders.Add(order); //attackOrderBindingSource.Add(order); order.ArrivleTime = time; } }
void HandleUnitsControls() { if (unitGroups.Count == 0) { return; } var enemyPlayers = Player.GetPlayerById(selfPlayerId).GetEnemyPlayers(); bool isAIHaveProductions = Player.GetPlayerById(selfPlayerId).playerProductionBuildings.Count > 0; // if AI have no productions, groups will be always not full, so in this case not full units groups should attack. var fullUnitGroups = unitGroups.FindAll(unitGroup => (!unitGroup.IsGroupNeedsUnits() || !isAIHaveProductions) && !unitGroup.IsGroupHaveOrder()); if (fullUnitGroups.Count == 0 || enemyPlayers.Count == 0) { return; } var randomlySelectedGroup = fullUnitGroups[Random.Range(0, fullUnitGroups.Count)]; var selectedEnemy = enemyPlayers[Random.Range(0, enemyPlayers.Count)]; var selectedTarget = Unit.allUnits.Find(unit => unit.OwnerPlayerId == selectedEnemy.id); var attackOrder = new AttackOrder(); attackOrder.attackTarget = selectedTarget; randomlySelectedGroup.AddOrderToGroup(attackOrder); }
public void CleanProperties() { List <Order> ordersClean = new List <Order>(); foreach (Order order in this.orders) { if (!order.isActive) { ordersClean.Add(order); } } foreach (Order order in ordersClean) { this.orders.Remove(order); //Debug.Log(order.GetType()); if (order.GetType().BaseType == typeof(AttackOrder)) { AttackOrder AO = (AttackOrder)order; //Debug.Log("P"+this.id + ": remove ordem de ataque do player " + (this.id == 0 ? 1 : 0)); GameController.players[(this.id == 0 ? 1 : 0)].enemyAttackOrders.Remove((AttackOrder)order); } } foreach (Order order in this.standbyOrders) { this.orders.Add(order); } ordersClean.Clear(); this.standbyOrders.Clear(); }
List <AttackOrderTuple> attackOrders = new List <AttackOrderTuple>(); //use as a queue, but with random access to remove dead ships public void addAttackOrder(AttackOrder order) { if (!(order is AutomaticAttackOrder)) { RemoveAutomaticOrders(); } order.target.Subscribe <ShipDestroyedMessage>(this); attackOrders.Add(AttackOrderToTuple(order)); }
AttackOrderTuple AttackOrderToTuple(AttackOrder order) { AttackUI ui = SimplePool.Spawn(attackUI).GetComponent <AttackUI>(); ui.Source = this.transform; ui.Target = order.target.transform; return(new AttackOrderTuple(order, ui)); }
public IdleAttackOrder(UnitStatsComponent stats, Vector3 currentPosition, Seeker seeker, GameObject self) { this.self = self; this.stats = stats; this.currentPosition = currentPosition; attackOrder = new AttackOrder(stats, currentPosition, null, seeker, self); }
private void tsmiUrlToClipboard_Click(object sender, EventArgs e) { AttackOrder order = SelectedOrder; if (order != null) { Clipboard.SetText(order.GetAttackUrl(Settings.Default.DSServer)); } }
private void tsmiTimeToTimer_Click(object sender, EventArgs e) { AttackOrder order = SelectedOrder; if (order != null) { OrderToTimer(order); } }
public AttackMoveOrder(UnitStatsComponent stats, Vector3 currentPosition, Seeker seeker, Vector3 targetPosition, GameObject attacker) { this.self = attacker; // the unit issuing the attack. inherited from Order this.stats = stats; this.currentPosition = currentPosition; this.seeker = seeker; this.targetPosition = targetPosition; attackOrder = new AttackOrder(stats, currentPosition, null, seeker, attacker); moveOrder = new MoveOrder(stats, currentPosition); }
private void OpenSelectedInBrowser() { foreach (DataGridViewRow row in dgvAttacks.SelectedRows) { if (row.DataBoundItem is AttackOrder) { AttackOrder order = (AttackOrder)row.DataBoundItem; m_AttackHandler.OpenBrowser(order); } } }
public static void GiveOrder(Vector2 screenPosition, bool isAdditive) { if (EventSystem.current.IsPointerOverGameObject()) { return; } if (Selection.selectedUnits.Count == 0 || Selection.selectedUnits[0].data.isBuilding) { return; } var ray = GameController.cachedMainCamera.ScreenPointToRay(screenPosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000)) { var unit = hit.collider.GetComponent <Unit>(); Order order = null; if (unit) { if (!GameController.instance.playersController.IsPlayersInOneTeam(unit.OwnerPlayerId, Player.localPlayerId)) { order = new AttackOrder(); (order as AttackOrder).attackTarget = unit; SpawnEffect(hit.point, GameController.instance.MainStorage.attackOrderEffect); } else { order = new FollowOrder(); (order as FollowOrder).followTarget = unit.transform; SpawnEffect(hit.point, GameController.instance.MainStorage.moveOrderEffect); var carryModule = unit.GetModule <CarryModule>(); if (unit.data.canCarryUnitsCount > 0 && carryModule && carryModule.CanCarryOneMoreUnit()) { carryModule.PrepareToCarryUnits(Selection.selectedUnits); } } } else { order = new MovePositionOrder(); (order as MovePositionOrder).movePosition = hit.point; SpawnEffect(hit.point, GameController.instance.MainStorage.moveOrderEffect); } SendOrderToSelection(order, isAdditive); } }
void PerformedClickOnTargetable(int mouse_button, bool queue_order, ref RaycastHit hit) { if (mouse_button == 1) { if (!queue_order) { orders.Clear(); } AttackOrder attack_order = new AttackOrder(stats, gameObject.transform.position, hit.collider.gameObject, seeker, gameObject); attack_order.projectilePrefab = projectilePrefab; orders.Add(attack_order); } }
//Client-only version public Response GenerateNonValidResponse(Order O) { //Temp if (O is MoveOrder) { MoveOrder MO = (MoveOrder)O; return(new MoveResponse(O.TargetID, new Vector3(MO.TarX, MO.TarY, MO.TarZ), CommandType.Movement)); } else if (O is AttackOrder) { AttackOrder AO = (AttackOrder)O; return(new DamageResponse(O.TargetID, AO.HPChange, CommandType.TargetAbility)); } throw new InvalidOperationException(); }
public void Resolve() { if (actionQueue.Count > 0) { if (actionQueue.Peek() is MovementOrder) { MovementOrder currentOrder = (MovementOrder)actionQueue.Peek(); parentChar.ResolveMovementOrder(currentOrder); } if (actionQueue.Peek() is AttackOrder) { AttackOrder currentOrder = (AttackOrder)actionQueue.Peek(); parentChar.ResolveAttackOrder(currentOrder); } } }
private void btnMoveSelected_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in dgvAttacks.SelectedRows) { if (row.DataBoundItem is AttackOrder) { AttackOrder order = (AttackOrder)row.DataBoundItem; order.ArrivleTime = order.ArrivleTime.Add( TimeSpan.FromDays((double)numDays.Value) + TimeSpan.FromHours((double)numHours.Value) + TimeSpan.FromMinutes((double)numMin.Value) + TimeSpan.FromSeconds((double)numSec.Value) + TimeSpan.FromMilliseconds((double)numMoveMs.Value) ); } } }
public override void Execute() { if (this.units.Count == 0) { this.isActive = false; return; } if (this.AO == null) { if (!this.executed) { this.executed = true; Property property = GetEnemyProperty(); if (property != null) { if (property.GetType().BaseType == typeof(Unit)) { List <Unit> targets = new List <Unit>(); targets.Add((Unit)property); this.AO = new AttackUnitOrder(this.units, targets, true, true); } else { this.AO = new AttackBuildingOrder(this.units, (Building)property, true); } } else { this.isActive = false; return; } } else { this.isActive = false; return; } } if (this.AO.Cooldown()) { this.AO.Execute(); } }
private void tsmiOrderAsNew_Click(object sender, EventArgs e) { AttackOrder order = this.SelectedOrder; ucStartVillageSelector.LocationSelector.SetLocation(order.StartLocation); ucTargetVillageSelector.LocationSelector.SetLocation(order.TargetLocation); if (rbArrivle.Checked) { dtpArrivle.Value = order.ArrivleTime; } else { dtpArrivle.Value = order.SendTime; } cbSlowestUnit.SelectedItem = order.Unit; txtNote.Text = order.Comment; }
public void ResolveAttackOrder(AttackOrder currentOrder) { Character attackTarget = currentOrder.target; Vector3 attackVector = attackTarget.getCharacterPosition() - character.transform.localPosition; float attackDistance = attackVector.magnitude; if (attackDistance > stats.AttackRange) { //if out of range, move towards target attackVector.Normalize(); character.transform.localPosition += attackVector * Time.deltaTime * stats.MoveSpeed; } else { if (attackCooldown == 0) { combatManager.Hit(this, attackTarget); } } }
void CreateNewOrder(Point position) { var selectedItem = (ListBoxItem)orderTypeListBox.SelectedItem; var orderTypeName = (string)selectedItem.Content; IOrder newOrder; switch (orderTypeName) { case "Move": newOrder = new MoveOrder(position.X, position.Y); break; case "Patrol": newOrder = new PatrolOrder(position.X, position.Y); break; case "Stop": newOrder = new StopOrder(); break; case "Fight": newOrder = new FightOrder(position.X, position.Y); break; case "Attack": newOrder = new AttackOrder(position.X, position.Y); break; case "Hold Position": newOrder = new MoveStateOrder(0); break; case "Maneuver": newOrder = new MoveStateOrder(1); break; case "Roam": newOrder = new MoveStateOrder(2); break; case "Hold Fire": newOrder = new FireStateOrder(0); break; case "Return Fire": newOrder = new FireStateOrder(1); break; case "Fire At Will": newOrder = new FireStateOrder(2); break; case "Enable Repeat Mode": newOrder = new RepeatOrder(1); break; case "Disable Repeat Mode": newOrder = new RepeatOrder(0); break; default: throw new Exception("Ordertype not expected: " + orderTypeName); } action.Orders.Add(newOrder); }
public AttackOrderTuple(AttackOrder order, AttackUI ui) { this.order = order; this.ui = ui; }
public void ReceiveGCMMessage(string message) { Dictionary<string, string> json = JsonConvert.DeserializeObject<Dictionary<string, string>>(message); //Is our packet class sent via GCM if (json.ContainsKey("packetType")) { if (getPacketType(json) == Packet.PacketType.LoginReturn) { DebugConsole.Log("Received Login Packet."); if (JsonConvert.DeserializeObject<bool[]>(json["sendBool"])[0]) { loginID = JsonConvert.DeserializeObject<string[]>(json["sendString"])[0]; loggedIn = true; GCM.ShowToast("You have logged in!"); } lastMessage = JsonConvert.DeserializeObject<string[]>(json["sendString"])[1]; } else if (getPacketType(json) == Packet.PacketType.NearbyPlayers) { DebugConsole.Log("Received Nearby Players Packet."); if (JsonConvert.DeserializeObject<float[]>(json["sendFloat"])[0] == 0.0f) { Data.Instance.nearbyPlayersIDs = JsonConvert.DeserializeObject<string[]>(json["sendString"]); } else Data.Instance.nearbyPlayersNames = JsonConvert.DeserializeObject<string[]>(json["sendString"]); } else if (getPacketType(json) == Packet.PacketType.Friends) { DebugConsole.Log("Received Friends Packet."); if (JsonConvert.DeserializeObject<int[]>(json["sendInt"])[0] == 0) { Data.Instance.friendsIDs = JsonConvert.DeserializeObject<string[]>(json["sendString"]); } else Data.Instance.friendsNames = JsonConvert.DeserializeObject<string[]>(json["sendString"]); } else if (getPacketType(json) == Packet.PacketType.Dictionary) { int type = JsonConvert.DeserializeObject<int[]>(json["sendInt"])[0]; switch (type) { //Resources Packet case 0: DebugConsole.Log("Received Resources Packet."); Data.Instance.UpdateResources(JsonConvert.DeserializeObject<Dictionary<int, uint>>(json["sendDictionary"])); break; //Food Packet case 1: DebugConsole.Log("Received Food Packet."); Data.Instance.UpdateFood(JsonConvert.DeserializeObject<Dictionary<int, uint>>(json["sendDictionary"])); break; //Units Packet case 2: DebugConsole.Log("Received Units Packet."); Data.Instance.UpdateUnits(JsonConvert.DeserializeObject<Dictionary<int, uint>>(json["sendDictionary"])); break; //Keep Packet case 3: DebugConsole.Log("Received Keep Packet."); Data.Instance.UpdateKeep(JsonConvert.DeserializeObject<Dictionary<int, uint>>(json["sendDictionary"])); break; } } else if (getPacketType(json) == Packet.PacketType.RequestWorker) { DebugConsole.Log("Received Current Workers Packet."); Data.Instance.workOrders.Clear(); List<TimeSpan> tList = new List<TimeSpan>(JsonConvert.DeserializeObject<TimeSpan[]>(json["sendTime"])); List<int> rList = new List<int>(JsonConvert.DeserializeObject<int[]>(json["sendInt"])); List<float> latList = new List<float>(JsonConvert.DeserializeObject<float[]>(json["sendFloat"])); List<float> longList = new List<float>(JsonConvert.DeserializeObject<float[]>(json["sendFloat2"])); List<int> aList = new List<int>(JsonConvert.DeserializeObject<int[]>(json["sendInt2"])); List<WorkOrder> temp = new List<WorkOrder>(); for (int i = 0; i < tList.Count; i++) { WorkOrder w = new WorkOrder(); w.type = WorkOrder.OrderType.Resource; w.duration = tList[i]; w.enumType = rList[i]; w.latitude = latList[i]; w.longitude = longList[i]; w.amount = aList[i]; temp.Add(w); } Data.Instance.workerPositions = temp; } else if (getPacketType(json) == Packet.PacketType.TileResources) { DebugConsole.Log("Received Tile Resources Packet."); Data.Instance.currentResources = JsonConvert.DeserializeObject<int[]>(json["sendInt"]); Data.mapReady = true; } else if (getPacketType(json) == Packet.PacketType.PlayerInfo) { DebugConsole.Log("Received Player Info Packet."); Data.Instance.playerName = JsonConvert.DeserializeObject<string[]>(json["sendString"])[0]; Data.Instance.gender = JsonConvert.DeserializeObject<bool[]>(json["sendBool"])[0]; } else if (getPacketType(json) == Packet.PacketType.WorkOrders) { DebugConsole.Log("Received Work Orders Packet."); string[] sArr = JsonConvert.DeserializeObject<string[]>(json["sendString"]); int[] iArr = JsonConvert.DeserializeObject<int[]>(json["sendInt"]); float[] fArr = JsonConvert.DeserializeObject<float[]>(json["sendFloat"]); System.TimeSpan[] tArr = JsonConvert.DeserializeObject<System.TimeSpan[]>(json["sendTime"]); List<WorkOrder> orders = new List<WorkOrder>(); for (int i = 0; i < sArr.Length; i++) { WorkOrder w = new WorkOrder(); w.type = (WorkOrder.OrderType)(int.Parse(sArr[i])); w.enumType = iArr[i]; w.amount = (int)fArr[i]; w.duration = tArr[i]; orders.Add(w); DebugConsole.Log(w.type.ToString() + "," + w.enumType + "," + w.amount + "," + w.duration.ToString()); } Data.Instance.workOrders = orders; } else if (getPacketType(json) == Packet.PacketType.AttackOrders) { DebugConsole.Log("Received Attack Order Packet."); AttackOrder a = new AttackOrder(); Dictionary<int, uint> tempDict = JsonConvert.DeserializeObject<Dictionary<int, uint>>(json["sendDictionary"]); Data.Instance.attackOrder.units.Clear(); foreach (KeyValuePair<int, uint> entry in tempDict) { Data.Instance.attackOrder.units.Add((Data.UnitNames)entry.Key, entry.Value); } Data.Instance.attackOrder.timeToDestination = JsonConvert.DeserializeObject<TimeSpan[]>(json["sendTime"])[0]; } } foreach (KeyValuePair<string, string> entry in json) { //DebugConsole.Log(entry.Key + ":" + entry.Value); } // DebugConsole.Log("/////////////////////"); }
void CloseWindow(object Sender, EventArgs E) { _Controller.Clear(); _AttackBuilder = null; }
private void DoCheatAction(CTrainingHelper.ECheatAct inAct, CTrainingHelper.EActTarget inTar, int inParam) { Player hostPlayer = Singleton <GamePlayerCenter> .instance.GetHostPlayer(); COM_PLAYERCAMP playerCamp = hostPlayer.PlayerCamp; COM_PLAYERCAMP cOM_PLAYERCAMP = (playerCamp == COM_PLAYERCAMP.COM_PLAYERCAMP_1) ? COM_PLAYERCAMP.COM_PLAYERCAMP_2 : COM_PLAYERCAMP.COM_PLAYERCAMP_1; COM_PLAYERCAMP inCamp = (inTar == CTrainingHelper.EActTarget.Hostile) ? cOM_PLAYERCAMP : playerCamp; switch (inAct) { case CTrainingHelper.ECheatAct.LevelUp: CTrainingHelper.HeroVisiter(inCamp, inParam, new Action <ActorRoot, int>(CTrainingHelper.LevelUp)); break; case CTrainingHelper.ECheatAct.SetLevel: CTrainingHelper.HeroVisiter(inCamp, inParam, new Action <ActorRoot, int>(CTrainingHelper.ResetSkillLevel)); CTrainingHelper.HeroVisiter(inCamp, inParam, new Action <ActorRoot, int>(CTrainingHelper.SetLevel)); break; case CTrainingHelper.ECheatAct.FullHp: CTrainingHelper.HeroVisiter(inCamp, inParam, new Action <ActorRoot, int>(CTrainingHelper.FullHp)); break; case CTrainingHelper.ECheatAct.FullEp: CTrainingHelper.HeroVisiter(inCamp, inParam, new Action <ActorRoot, int>(CTrainingHelper.FullEp)); break; case CTrainingHelper.ECheatAct.ToggleInvincible: { SLevelContext curLvelContext = Singleton <BattleLogic> .instance.GetCurLvelContext(); bool arg_F7_0 = curLvelContext != null && curLvelContext.IsMobaMode(); Player hostPlayer2 = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer(); if (hostPlayer2 != null && hostPlayer2.Captain && hostPlayer2.Captain.handle.ActorControl is HeroWrapper) { HeroWrapper heroWrapper = (HeroWrapper)hostPlayer2.Captain.handle.ActorControl; heroWrapper.bGodMode = !heroWrapper.bGodMode; } this.m_invincibleToggleFlag = !this.m_invincibleToggleFlag; this.RefreshBtnToggleInvincible(); break; } case CTrainingHelper.ECheatAct.ToggleAi: CTrainingHelper.HeroVisiter(inCamp, inParam, new Action <ActorRoot, int>(CTrainingHelper.ToggleAi)); this.m_aiToggleFlag = !this.m_aiToggleFlag; this.RefreshBtnToggleAi(); break; case CTrainingHelper.ECheatAct.ToggleSoldier: Singleton <BattleLogic> .GetInstance().mapLogic.EnableSoldierRegion(this.m_soldierToggleFlag); this.m_soldierToggleFlag = !this.m_soldierToggleFlag; this.RefreshBtnToggleSoldier(); break; case CTrainingHelper.ECheatAct.ResetSoldier: { Singleton <BattleLogic> .instance.mapLogic.ResetSoldierRegion(); Singleton <BattleLogic> .instance.dynamicProperty.ResetTimer(); Singleton <GameObjMgr> .GetInstance().KillSoldiers(); CTrainingHelper.OrganVisiter(COM_PLAYERCAMP.COM_PLAYERCAMP_1, inParam, new Action <ActorRoot, int>(CTrainingHelper.ReviveTower)); CTrainingHelper.OrganVisiter(COM_PLAYERCAMP.COM_PLAYERCAMP_2, inParam, new Action <ActorRoot, int>(CTrainingHelper.ReviveTower)); AttackOrder attackOrder = Singleton <BattleLogic> .instance.attackOrder; if (attackOrder != null) { attackOrder.FightOver(); attackOrder.FightStart(); } break; } case CTrainingHelper.ECheatAct.AddGold: { SLevelContext curLvelContext2 = Singleton <BattleLogic> .instance.GetCurLvelContext(); bool arg_268_0 = curLvelContext2 != null && curLvelContext2.IsMobaMode(); Player hostPlayer3 = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer(); if (hostPlayer3 != null && hostPlayer3.Captain) { if (hostPlayer3.Captain.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Call) { CallActorWrapper callActorWrapper = hostPlayer3.Captain.handle.ActorControl as CallActorWrapper; if (callActorWrapper != null && callActorWrapper.hostActor) { callActorWrapper.hostActor.handle.ValueComponent.ChangeGoldCoinInBattle(1000, true, true, default(Vector3), false, default(PoolObjHandle <ActorRoot>)); } } else if (hostPlayer3.Captain.handle.ValueComponent != null) { hostPlayer3.Captain.handle.ValueComponent.ChangeGoldCoinInBattle(1000, true, true, default(Vector3), false, default(PoolObjHandle <ActorRoot>)); } } break; } case CTrainingHelper.ECheatAct.ToggleZeroCd: CTrainingHelper.HeroVisiter(inCamp, inParam, new Action <ActorRoot, int>(CTrainingHelper.ToggleZeroCd)); this.m_cdToggleFlag = !this.m_cdToggleFlag; this.RefreshBtnToggleCd(); break; } }
void dgvAttacks_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { AttackOrder order = (AttackOrder)dgvAttacks.Rows[e.RowIndex].DataBoundItem; if (dgvAttacks.Columns[e.ColumnIndex].Name == "StartLocation") { if (e.Value == null) { return; } Location p = (Location)e.Value; e.Value = String.Format("({0}|{1}) {2}", p.X, p.Y, order.StartVilliage.Name); e.FormattingApplied = true; } if (dgvAttacks.Columns[e.ColumnIndex].Name == "TargetLocation") { if (e.Value == null) { return; } Location p = (Location)e.Value; e.Value = String.Format("({0}|{1}) {2}", p.X, p.Y, order.TargetVillage.Name); e.FormattingApplied = true; } if (order == null) { return; } if (TimeSyncHandler.Now.AddMinutes(5) < order.SendTime) { e.CellStyle.BackColor = Color.LightGreen; e.CellStyle.SelectionBackColor = Color.LightGreen; } else if (TimeSyncHandler.Now < order.SendTime) { e.CellStyle.BackColor = Color.Orange; e.CellStyle.SelectionBackColor = Color.Orange; } else { e.CellStyle.BackColor = Color.LightCoral; e.CellStyle.SelectionBackColor = Color.LightCoral; } /* Geht nicht * if (dgvAttacks.Columns[e.ColumnIndex].Name.Equals("UnitSpeed")) * { * // Ensure that the value is a string. * String stringValue = e.Value as string; * if (stringValue == null) return; * * // Set the cell ToolTip to the text value. * DataGridViewCell cell = dgvAttacks[e.ColumnIndex, e.RowIndex]; * cell.ToolTipText = stringValue; * * // Replace the string value with the image value. * e.Value = System.Drawing.SystemIcons.Asterisk; * } * */ }
private void OrderToTimer(AttackOrder order) { Settings.Default.NextAttack = order.SendTime; Settings.Default.Note = "* " + order.Comment; Settings.Default.Save(); }
private void btnDisplayInMiniTimer_Click(object sender, EventArgs e) { AttackOrder order = m_AttackHandler.NextOrder; OrderToTimer(order); }