using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Timers;
namespace AutobotManager
{
public class BotStyleItem : INotifyPropertyChanged
{
public BotStyleItem(String a_sSimName, int a_iSim)
{
m_sSimName = a_sSimName;
m_iSim = a_iSim;
m_iCreatedCount = 0;
m_iTotalKilled = 0;
m_iTotalCrashed = 0;
m_iActive_IDLE = 0;
m_iActive_Running = 0;
m_iActive_Dying = 0;
}
public void Reset()
{
m_iCreatedCount = 0;
m_iTotalKilled = 0;
m_iTotalCrashed = 0;
Active_IDLE = 0;
Active_Running = 0;
Active_Dying = 0;
}
public event PropertyChangedEventHandler PropertyChanged;
// This method is called by the Set accessor of each property.
// The CallerMemberName attribute that is applied to the optional propertyName
// parameter causes the property name of the caller to be substituted as an argument.
private void NotifyPropertyChanged(String propertyName = "")
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#region Methods
public void AddCreated() { ++CreatedCount; NotifyPropertyChanged(); }
public void AddCrashed() { ++TotalCrashed; NotifyPropertyChanged(); }
public void AddKill() { ++TotalKilled; NotifyPropertyChanged(); }
public void ReduceStateType(BotState a_eState)
{
switch (a_eState)
{
case BotState.BotState_IDLE: --Active_IDLE; break;
case BotState.BotState_Running: --Active_Running; break;
case BotState.BotState_Dying: --Active_Dying; break;
}
}
public void AddStateType(BotState a_eState)
{
switch(a_eState)
{
case BotState.BotState_IDLE: ++Active_IDLE; break;
case BotState.BotState_Running: ++Active_Running; break;
case BotState.BotState_Dying: ++Active_Dying; break;
}
}
public int GetActiveCount()
{
return (Active_IDLE + Active_Running + Active_Dying);
}
#endregion
#region Data
private String m_sSimName;
private int m_iSim;
private int m_iCreatedCount;
private int m_iTotalKilled;
private int m_iTotalCrashed;
private int m_iActive_IDLE;
private int m_iActive_Running;
private int m_iActive_Dying;
[DisplayName("Style")]
[ReadOnly(true)]
public String SimName { get { return this.m_sSimName; } set { if (value != this.m_sSimName) { this.m_sSimName = value; NotifyPropertyChanged("m_sSimName"); } } }
[Browsable(false)]
public int SimID { get { return this.m_iSim; } set { if (value != this.m_iSim) { this.m_iSim = value; NotifyPropertyChanged("m_iSim"); } } }
[DisplayName("Created")]
[ReadOnly(true)]
public int CreatedCount { get { return this.m_iCreatedCount; } set { if (value != this.m_iCreatedCount) { this.m_iCreatedCount = value; NotifyPropertyChanged("m_iCreatedCount"); } } }
[DisplayName("Crashed")]
[ReadOnly(true)]
public int TotalCrashed { get { return this.m_iTotalCrashed; } set { if (value != this.m_iTotalCrashed) { this.m_iTotalCrashed = value; NotifyPropertyChanged("m_iTotalCrashed"); } } }
[DisplayName("Killed")]
[ReadOnly(true)]
public int TotalKilled { get { return this.m_iTotalKilled; } set { if (value != this.m_iTotalKilled) { this.m_iTotalKilled = value; NotifyPropertyChanged("m_iTotalKilled"); } } }
[DisplayName("Idle")]
[ReadOnly(true)]
public int Active_IDLE { get { return this.m_iActive_IDLE; } set { if (value != this.m_iActive_IDLE) { this.m_iActive_IDLE = value; NotifyPropertyChanged("m_iActive_IDLE"); } } }
[DisplayName("Running")]
[ReadOnly(true)]
public int Active_Running { get { return this.m_iActive_Running; } set { if (value != this.m_iActive_Running) { this.m_iActive_Running = value; NotifyPropertyChanged("m_iActive_Running"); } } }
[DisplayName("Dying")]
[ReadOnly(true)]
public int Active_Dying { get { return this.m_iActive_Dying; } set { if (value != this.m_iActive_Dying) { this.m_iActive_Dying = value; NotifyPropertyChanged("m_iActive_Dying"); } } }
#endregion // Data
}
}