private void AdvanceTypeRBs_CheckedChange(object sender, CompoundButton.CheckedChangeEventArgs e)
        {
            try
            {
                if (!e.IsChecked)
                {
                    return;
                }

                switch ((sender as RadioButton).Id)
                {
                case Resource.Id.PSAdvanceProductType1:
                    typeAdvance = AdvanceType._1;
                    break;

                case Resource.Id.PSAdvanceProductType2:
                    typeAdvance = AdvanceType._2;
                    break;

                case Resource.Id.PSAdvanceProductType3:
                    typeAdvance = AdvanceType._3;
                    break;
                }
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, this);
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var rnd    = new Random();
            var list   = new List <Colony>();
            var colony = new Colony();

            colony.Initialize("Mars", "Wójcik", ColonyType.Authoritarian);
            var year = 1;

            while (true)
            {
                Console.WriteLine("Year: " + year);

                Console.SetCursorPosition(0, 0);
                colony.CalculateIncomes();
                colony.CalculateQualities();
                //begin
                colony.GiveResources();
                //players decisions
                //var adv = AdvanceType.Industry;
                //var adv = GenerateDecision<AdvanceType>(rnd);
                var         sup      = GenerateDecision <SupportType>(rnd);
                AdvanceType adv      = AdvanceType.None;
                var         decision = 0;
                EnumToString <AdvanceType>();
                if (int.TryParse(Console.ReadKey().KeyChar.ToString(), out decision))
                {
                    Console.Write("\r         ");
                    adv      = (AdvanceType)decision;
                    decision = 0;
                    Console.Clear();
                }
                Console.WriteLine();
                //Console.Write);
                colony.Process(adv, sup);
                Console.WriteLine("[{0}]({1})", adv, sup);
                Console.WriteLine(colony.ToText());

                //end

                var cl = new List <Colony>();
                list.Add(colony.Clone());
                ++year;
                if (colony.IsDead())
                {
                    break;
                }
            }
            Console.WriteLine("Year: " + year);
            Console.WriteLine("Koniec gry");
            Console.ReadLine();
        }
Ejemplo n.º 3
0
        //PROCESS
        public void Process(AdvanceType advance, SupportType support)
        {
            var v1 = Technology > 0 ? (Technology * Industry) / (Technology + Industry) : 0;

            if (advance == AdvanceType.Food)
            {
                this.Food = Food + GLOBALS.AdvFoodCount + v1; //+ (Industry * GLOBALS.IndustryMaterialsWage)
            }
            else
            if (advance == AdvanceType.Houses)
            {
                this.Houses = Houses + GLOBALS.AdvHouseCount + v1;
            }
            else
            if (advance == AdvanceType.Industry)
            {
                this.Industry = Industry + GLOBALS.AdvIndustryCount + (Technology * GLOBALS.TechnologyWage);
            }
            else
            if (advance == AdvanceType.Education)
            {
                // this.Industry = Industry + (int)GLOBALS.AdvIndustryCount;
            }
            else
            if (advance == AdvanceType.Culture)
            {
                this.Culture = Culture + GLOBALS.AdvCultureCount + (Technology * GLOBALS.TechnologyWage);
            }
            else
            if (advance == AdvanceType.Technology)
            {
                this.Industry = Industry * GLOBALS.AdvTechnologyMultipliar;
                this.Houses   = Houses * GLOBALS.AdvTechnologyMultipliar;
                this.Food     = Food * GLOBALS.AdvTechnologyMultipliar;
                this.Culture  = Culture * GLOBALS.AdvTechnologyMultipliar;

                this.Technology = Technology + 1;
            }
        }
 /// <summary>
 /// Fill object data from xml node
 /// </summary>
 /// <param name="source"></param>
 protected override void LoadFromXmlNode(XmlNode source)
 {
     base.LoadFromXmlNode(source);
     this.Left  = CreateFromXml <AdvanceType>(GetChildNode(source, "left-type"));
     this.Right = CreateFromXml <AdvanceType>(GetChildNode(source, "right-type"));
 }
 /// <summary>
 /// Cnstructor.
 /// wire binds two parametric types with different type argument count
 /// </summary>
 /// <param name="binding">actual binding causing the problem</param>
 /// <param name="left">left side of binding</param>
 /// <param name="right">right side of  binding</param>
 public CombinedTypeError(AdvanceBlockBind binding, AdvanceType left, AdvanceType right)
 {
     this.binding = binding;
     this.Left    = left;
     this.Right   = right;
 }
 /// <summary>
 /// Fill object data from xml node
 /// </summary>
 /// <param name="source">Source Xml</param>
 protected override void LoadFromXmlNode(XmlNode source)
 {
     this.IsInput = GetBoolAttribute(source, "is-input", true);
     this.Id      = GetAttribute(source, "id");
     this.Type    = CreateFromXml <AdvanceType>(source);
 }
 /// <summary>
 /// Constructor.
 /// wire binds two parametric types with different type argument count
 /// </summary>
 /// <param name="binding">actual binding causing the problem</param>
 /// <param name="left">left side of binding</param>
 /// <param name="right">right side of  binding</param>
 public ConcreteVsParametricTypeError(AdvanceBlockBind binding, AdvanceType left, AdvanceType right)
 {
     this.binding = binding;
     this.Left    = left;
     this.Right   = right;
 }
 /// <summary>
 /// Constructor.
 /// wire binds two parametric types with different type argument count
 /// </summary>
 /// <param name="binding">actual binding causing the problem</param>
 /// <param name="left">left side of binding</param>
 /// <param name="right">right side of  binding</param>
 public IncompatibleBaseTypesError(AdvanceBlockBind binding, AdvanceType left, AdvanceType right)
 {
     this.binding = binding;
     this.Left    = left;
     this.Right   = right;
 }
 /// <summary>
 /// Cnstructor.
 /// wire binds two parametric types with different type argument count
 /// </summary>
 /// <param name="binding">actual binding causing the problem</param>
 /// <param name="left">left side of binding</param>
 /// <param name="right">right side of  binding</param>
 public TypeArgumentCountError(AdvanceBlockBind binding, AdvanceType left, AdvanceType right)
 {
     this.binding = binding;
     this.Left    = left;
     this.Right   = right;
 }