Exemple #1
0
 public FieldInstance(E_OverlapEvent overlapEvent, ObjectField objectField, WorldAnchor anchor)
     : base(objectField.CollisionWidth, objectField.CollisionHeigth, anchor)
 {
     this.objectField = objectField;
     this.overlapEvent = overlapEvent;
     vectorControl = new VectorControl(this);
 }
Exemple #2
0
 public FieldObject(FieldObjectEntity objectField, WorldAnchor anchor)
     : base(objectField.collisionWidth, objectField.collisionHeight, anchor)
 {
     this.objectField = objectField;
     this.overlapEvent = objectField.overlapEventType;
     vectorControl = new VectorControl(this);
 }
Exemple #3
0
        protected override OptionResult Run(GameHitParameters <Sim> parameters)
        {
            List <VectorBooter.Item> choices = VectorBooter.GetVectorItems(parameters.mTarget.SimDescription);

            CommonSelection <VectorBooter.Item> .Results items = new CommonSelection <VectorBooter.Item>(Name, choices).SelectMultiple();
            if ((items == null) || (items.Count == 0))
            {
                return(OptionResult.Failure);
            }

            string vectors = null;

            foreach (VectorBooter.Item item in items)
            {
                VectorControl.Inoculate(parameters.mTarget.SimDescription, item.Value, true, false);

                vectors += Common.NewLine + " " + item.Value.GetLocalizedName(parameters.mTarget.IsFemale);
            }

            if (!string.IsNullOrEmpty(vectors))
            {
                Common.Notify(parameters.mTarget, Common.Localize("Inoculate:Success", parameters.mTarget.IsFemale, new object[] { parameters.mTarget }) + vectors);
            }

            return(OptionResult.SuccessClose);
        }
Exemple #4
0
        private void vector_B_Click(object sender, EventArgs e)
        {
            var result = GetVectorDimensions(sender as Control);

            if (!result.HasValue)
            {
                return;
            }
            ClearB();
            var v  = new Vector(result.Value);
            var vc = new VectorControl(v, pnlB);

            vc.Grid.ContextMenuStrip = cntxMenu;
            vc.Grid.Focus();
            ArrangeControls();
            RecordState();
        }
Exemple #5
0
        private AritmeticControl CreateAritmeticControl(BaseMathEntity entity, Control container)
        {
            AritmeticControl ac = null;

            if (entity is Number)
            {
                ac = new NumberControl((Number)entity, container);
            }
            else if (entity is Vector)
            {
                ac = new VectorControl((Vector)entity, container);
            }
            else if (entity is Matrix)
            {
                ac = new MatrixControl((Matrix)entity, container);
            }

            if (ac != null)
            {
                ac.Grid.ContextMenuStrip = cntxMenu;
            }

            return(ac);
        }
Exemple #6
0
        public static void OnAccept(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i)
        {
            try
            {
                VaccinationSessionSituation situation = VaccinationSessionSituation.GetVaccinationSessionSituation(actor);
                if (situation != null)
                {
                    situation.NumVaccinations++;
                    situation.AddToIgnoreList(target);
                    situation.BringRandomSimsToSession(0x1);
                }
                else
                {
                    FreeClinicSessionSituation freeClinicSessionSituation = FreeClinicSessionSituation.GetFreeClinicSessionSituation(actor);
                    if (freeClinicSessionSituation != null)
                    {
                        freeClinicSessionSituation.NumVaccinations++;
                        freeClinicSessionSituation.AddToIgnoreList(target);
                        freeClinicSessionSituation.BringRandomSimsToSession(0x1);
                    }
                }

                Medical medical = actor.Occupation as Medical;
                if ((medical != null) && (medical.Level >= 3))
                {
                    string vectors = null;

                    List <VectorBooter.Item> items = new List <VectorBooter.Item>();

                    int cost = 0;

                    foreach (VectorBooter.Data vector in VectorBooter.Vectors)
                    {
                        if (VectorControl.Inoculate(target.SimDescription, vector, true, true))
                        {
                            vectors += Common.NewLine + " " + vector.GetLocalizedName(target.IsFemale);

                            cost += (vector.InoculationCost / 25);
                        }
                    }

                    if (string.IsNullOrEmpty(vectors))
                    {
                        if (situation == null)
                        {
                            Common.Notify(target, Common.Localize("Inoculate:None", target.IsFemale, new object[] { target }));
                        }
                    }
                    else
                    {
                        string paid = null;
                        if (cost > target.FamilyFunds)
                        {
                            cost = target.FamilyFunds;
                        }

                        target.ModifyFunds(-cost);

                        if (target.Household != actor.Household)
                        {
                            actor.ModifyFunds(cost);

                            if (cost > 0)
                            {
                                paid += Common.NewLine + Common.NewLine + Common.Localize("Inoculate:Paid", target.IsFemale, new object[] { cost });
                            }
                        }
                        else
                        {
                            if (cost > 0)
                            {
                                paid += Common.NewLine + Common.NewLine + Common.Localize("Inoculate:Charged", target.IsFemale, new object[] { cost });
                            }
                        }

                        Common.Notify(target, Common.Localize("Inoculate:Success", target.IsFemale, new object[] { target }) + vectors + paid);
                    }
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
            }
        }
Exemple #7
0
 public FieldObject(OverlapEventType overlapEvent, float width, float height, WorldAnchor anchor)
     : base(width, height, anchor)
 {
     this.overlapEvent = overlapEvent;
     vectorControl = new VectorControl(this);
 }
Exemple #8
0
 public FieldInstance(E_OverlapEvent overlapEvent, float width, float height, WorldAnchor anchor)
     : base(width, height, anchor)
 {
     this.overlapEvent = overlapEvent;
     vectorControl = new VectorControl(this);
 }