Exemplo n.º 1
0
 public void Cleanup()
 {
     World.OnObjectPlacedInLotEventHandler -= new EventHandler(this.AddInteractionsToOverlappingObjects);
     for (int i = 0; i < this.mObjectsWithMyInteraction.Count; i++)
     {
         GameObject gameObject = GlobalFunctions.ConvertGuidToObject <GameObject>(this.mObjectsWithMyInteraction[i]);
         gameObject.RemoveInteractionByType(StoreSetBase.ChildObjectPurchaseStub.Singleton);
         gameObject.RemoveInteractionByType(StoreSetBase.ChildObjectBrowseStub.Singleton);
     }
     this.mObjectsWithMyInteraction.Clear();
 }
Exemplo n.º 2
0
 public void RemoveInteractionsFromChildren()
 {
     for (int i = 0; i < this.mObjectsWithMyInteraction.Count; i++)
     {
         GameObject gameObject = GlobalFunctions.ConvertGuidToObject <GameObject>(this.mObjectsWithMyInteraction[i]);
         if (gameObject != null)
         {
             gameObject.RemoveInteractionByType(StoreSetBase.ChildObjectPurchaseStub.Singleton);
             gameObject.RemoveInteractionByType(StoreSetBase.ChildObjectBrowseStub.Singleton);
         }
     }
     this.mObjectsWithMyInteraction.Clear();
 }
Exemplo n.º 3
0
        public static void AddInteractions(GameObject obj)
        {
            Grill         grill     = obj as Grill;
            Stove         stove     = obj as Stove;
            Fridge        fridge    = obj as Fridge;
            Microwave     micro     = obj as Microwave;
            FoodProcessor processor = obj as FoodProcessor;

            if (obj != null && obj.Interactions != null)
            {
                if (fridge != null)
                {
                    InteractionObjectPair i2 = new InteractionObjectPair(OverridedFridge_Have.Singleton, obj);
                    if (!obj.Interactions.Contains(i2))
                    {
                        obj.RemoveInteractionByType(Fridge_Have.Singleton);
                        // obj.Interactions.RemoveAt(0);
                        obj.AddInteraction(OverridedFridge_Have.Singleton);
                        obj.AddInteraction(OverridedFridge_Prepare.PrepareSingleton);
                    }
                }
                else if (micro != null)
                {
                    InteractionObjectPair i2 = new InteractionObjectPair(OverridedMicrowave_Have.Singleton, obj);
                    if (!obj.Interactions.Contains(i2))
                    {
                        obj.AddInteraction(OverridedMicrowave_Have.Singleton);
                    }
                }
                else if (processor != null)
                {
                    InteractionObjectPair i2 = new InteractionObjectPair(OverridedFoodProcessor_Have.Singleton, obj);
                    if (!obj.Interactions.Contains(i2))
                    {
                        obj.AddInteraction(OverridedFoodProcessor_Have.Singleton);
                    }
                }
                else if (stove != null)
                {
                    InteractionObjectPair i2 = new InteractionObjectPair(OverridedStove_Have.Singleton, obj);
                    if (!obj.Interactions.Contains(i2))
                    {
                        obj.AddInteraction(OverridedStove_Have.Singleton);
                    }
                }
                else if (grill != null)
                {
                    InteractionObjectPair i2 = new InteractionObjectPair(OverridedGrill_Have.Singleton, obj);
                    if (!obj.Interactions.Contains(i2))
                    {
                        obj.AddInteraction(OverridedGrill_Have.Singleton);
                    }
                }
            }
        }
Exemplo n.º 4
0
        public static void InitInteractions(GameObject obj)
        {
            ServingContainer container = obj as ServingContainer;

            if (container != null)
            {
                // EA fail
                container.RemoveInteractionByType(ServingContainerGroup.CallToMeal.Singleton);
            }

            WeddingCake cake = obj as WeddingCake;

            if (cake != null)
            {
                cake.RemoveInteractionByType(WeddingCake.CutWeddingCake.Singleton);
            }

            Snack container2 = obj as Snack;

            if (container2 != null)
            {
                if (obj != null)
                {
                    obj.RemoveInteractionByType(CraftersConsignment.ChildObjectBrowseStub.Singleton);
                    obj.RemoveInteractionByType(CraftersConsignment.ChildObjectPurchaseStub.Singleton);
                    obj.AddInteraction(CraftersConsignment.ChildObjectBrowseStub.Singleton);
                    obj.AddInteraction(CraftersConsignment.ChildObjectPurchaseStub.Singleton);

                    obj.RemoveInteractionByType(Sims3.Gameplay.Objects.CookingObjects.Eat.Singleton);
                    obj.RemoveInteractionByType(Snack_CleanUp.Singleton);
                }

                ISpoilable spoil = container2 as ISpoilable;
                if (spoil != null)
                {
                    spoil.UpdateSpoilageTime(true, -1f);
                }
            }
        }
Exemplo n.º 5
0
        public void AddInteractionsToChildren()
        {
            this.RemoveInteractionsFromChildren();
            List <ObjectGuid> objectsICanBuyInDisplay = this.GetObjectIDsICanBuyInDisplay(null, false);

            for (int i = 0; i < objectsICanBuyInDisplay.Count; i++)
            {
                GameObject gameObject = GlobalFunctions.ConvertGuidToObject <GameObject>(objectsICanBuyInDisplay[i]);
                if (gameObject != null)
                {
                    if (StoreHelperClass.AddPurchaseInteraction(null, gameObject, null, true))
                    {
                        gameObject.RemoveAllInteractions();
                        this.mObjectsWithMyInteraction.Add(objectsICanBuyInDisplay[i]);
                        gameObject.RemoveInteractionByType(StoreSetBase.ChildObjectPurchaseStub.Singleton);
                        gameObject.RemoveInteractionByType(StoreSetBase.ChildObjectBrowseStub.Singleton);
                        gameObject.AddInteraction(new StoreSetBase.ChildObjectPurchaseStub.Definition(base.ObjectId));
                        gameObject.AddInteraction(new StoreSetBase.ChildObjectBrowseStub.Definition(base.ObjectId));
                    }
                }
            }
        }
Exemplo n.º 6
0
        public static void InitInteractions(GameObject obj)
        {
            ServingContainer container = obj as ServingContainer;
            if (container != null)
            {
                // EA fail
                container.RemoveInteractionByType(ServingContainerGroup.CallToMeal.Singleton);
            }

            WeddingCake cake = obj as WeddingCake;
            if (cake != null)
            {
                cake.RemoveInteractionByType(WeddingCake.CutWeddingCake.Singleton);
            }

            Snack container2 = obj as Snack;
            if (container2 != null)
            {
                if (obj != null)
                {
                    obj.RemoveInteractionByType(CraftersConsignment.ChildObjectBrowseStub.Singleton);
                    obj.RemoveInteractionByType(CraftersConsignment.ChildObjectPurchaseStub.Singleton);
                    obj.AddInteraction(CraftersConsignment.ChildObjectBrowseStub.Singleton);
                    obj.AddInteraction(CraftersConsignment.ChildObjectPurchaseStub.Singleton);

                    obj.RemoveInteractionByType(Sims3.Gameplay.Objects.CookingObjects.Eat.Singleton);
                    obj.RemoveInteractionByType(Snack_CleanUp.Singleton);
                }

                ISpoilable spoil = container2 as ISpoilable;
                if (spoil != null)
                {
                    spoil.UpdateSpoilageTime(true, -1f);
                }
            }
        }
Exemplo n.º 7
0
        public static void AddInteractions(GameObject obj)
        {
            //Grill grill = obj as Grill;
            //Stove stove = obj as Stove;
            //Fridge fridge = obj as Fridge;
            //Microwave micro = obj as Microwave;
            //FoodProcessor processor = obj as FoodProcessor;

            if (obj != null && obj.Interactions != null)
            {
                if (obj is Fridge)                 //(fridge != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedFridge_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    // {
                    obj.RemoveInteractionByType(typeof(Fridge_Have.Definition));
                    obj.RemoveInteractionByType(typeof(Fridge_Prepare.PrepareDefinition));
                    // obj.Interactions.RemoveAt(0);
                    obj.AddInteraction(OverridedFridge_Have.Singleton, true);
                    obj.AddInteraction(OverridedFridge_Prepare.PrepareSingleton, true);

                    //}
                }
                else if (obj is Microwave)                //(micro != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedMicrowave_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
                    obj.RemoveInteractionByType(typeof(Microwave_Have.Definition));
                    obj.AddInteraction(OverridedMicrowave_Have.Singleton, true);

                    //}
                }
                else if (obj is FoodProcessor)                //(processor != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedFoodProcessor_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
                    obj.RemoveInteractionByType(typeof(FoodProcessor.FoodProcessor_Have.Definition));
                    obj.AddInteraction(OverridedFoodProcessor_Have.Singleton, true);
                    //}
                }
                else if (obj is Stove)                //(stove != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedStove_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
                    obj.RemoveInteractionByType(typeof(Stove_Have.Definition));
                    obj.AddInteraction(OverridedStove_Have.Singleton, true);
                    //}
                }
                else if (obj is Grill)                //(grill != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedGrill_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
                    obj.RemoveInteractionByType(typeof(Grill_Have.Definition));
                    obj.AddInteraction(OverridedGrill_Have.Singleton, true);
                    //}
                }
            }
        }
Exemplo n.º 8
0
        public static void RemoveMoveInteractions(GameObject gameObject)
        {
            gameObject.RemoveInteractionByType(TurnLeft.Singleton);
            gameObject.RemoveInteractionByType(TurnAtAngle.Singleton);
            gameObject.RemoveInteractionByType(TurnRight.Singleton);
            gameObject.RemoveInteractionByType(TurnAround.Singleton);
            gameObject.RemoveInteractionByType(TiltFaceUp.Singleton);
            gameObject.RemoveInteractionByType(TiltBack.Singleton);
            gameObject.RemoveInteractionByType(TiltForward.Singleton);
            gameObject.RemoveInteractionByType(TiltFaceDown.Singleton);
            gameObject.RemoveInteractionByType(TiltUserDefined.Singleton);

            gameObject.RemoveInteractionByType(MoveUp.Singleton);
            gameObject.RemoveInteractionByType(MoveUpUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveDown.Singleton);
            gameObject.RemoveInteractionByType(MoveDownUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveBack.Singleton);
            gameObject.RemoveInteractionByType(MoveBackUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveForward.Singleton);
            gameObject.RemoveInteractionByType(MoveForwardUserDefined.Singleton);

            gameObject.RemoveInteractionByType(MoveRight.Singleton);
            gameObject.RemoveInteractionByType(MoveRightUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveLeft.Singleton);
            gameObject.RemoveInteractionByType(MoveLeftUserDefined.Singleton);
        }
        public static void RemoveMoveInteractions(GameObject gameObject, bool resetLocation)
        {
            if (MovedObjects.ContainsKey(gameObject))
            {
                if (resetLocation)
                {
                    LocationVectors vectors;
                    if (MovedObjects.TryGetValue(gameObject, out vectors))
                    {
                        gameObject.SetForward(vectors.ForwardVector);
                        gameObject.SetPosition(vectors.Position);
                    }
                }
                MovedObjects.Remove(gameObject);
            }
            gameObject.RemoveInteractionByType(StopMovingMe.Singleton);

            gameObject.RemoveInteractionByType(TurnLeft.Singleton);
            gameObject.RemoveInteractionByType(TurnAtAngle.Singleton);
            gameObject.RemoveInteractionByType(TurnRight.Singleton);
            gameObject.RemoveInteractionByType(TurnAround.Singleton);
            gameObject.RemoveInteractionByType(TiltFaceUp.Singleton);
            gameObject.RemoveInteractionByType(TiltBack.Singleton);
            gameObject.RemoveInteractionByType(TiltForward.Singleton);
            gameObject.RemoveInteractionByType(TiltFaceDown.Singleton);
            gameObject.RemoveInteractionByType(TiltUserDefined.Singleton);

            gameObject.RemoveInteractionByType(MoveUp.Singleton);
            gameObject.RemoveInteractionByType(MoveUpUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveDown.Singleton);
            gameObject.RemoveInteractionByType(MoveDownUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveBack.Singleton);
            gameObject.RemoveInteractionByType(MoveBackUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveForward.Singleton);
            gameObject.RemoveInteractionByType(MoveForwardUserDefined.Singleton);

            gameObject.RemoveInteractionByType(MoveRight.Singleton);
            gameObject.RemoveInteractionByType(MoveRightUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveLeft.Singleton);
            gameObject.RemoveInteractionByType(MoveLeftUserDefined.Singleton);
        }
Exemplo n.º 10
0
        public static void AddInteractions(GameObject obj)
        {
            if (obj != null && obj.Interactions != null)
            {
                //Show the interactions only when at home
                WorldType type = GameUtils.GetCurrentWorldType();
                if (type != WorldType.Vacation)
                {
                    // InteractionObjectPair i = new InteractionObjectPair(RegisterInteraction.ShopFromInventory.Singleton, obj);
                    InteractionObjectPair i = new InteractionObjectPair(ShoppingRegister.Buy.Singleton, obj);
                    if (obj.Interactions.Contains(i))
                    {
                        //StyledNotification.Show(new StyledNotification.Format(obj.GetType().ToString(), StyledNotification.NotificationStyle.kGameMessageNegative));
                        //Replace the original buyfood interaction
                        if (obj.GetType() == typeof(FoodStoreRegister))
                        {
                            obj.RemoveInteractionByType(ShoppingRegister.Buy.Singleton);
                            obj.RemoveInteractionByType(ShoppingRegister.Buy_Food.Singleton);

                            obj.AddInteraction(OverridedFoodRegister.Buy.Singleton);
                            obj.AddInteraction(OverridedFoodRegister.CallForMeal.Singleton);
                            obj.AddInteraction(OverridedFoodRegisterServing.Buy.Singleton);

                            obj.AddInteraction(OverridedFoodRegister.CallForCoffee.Singleton);
                            obj.AddInteraction(OverridedFoodRegister.BuyConcessionDrink.Singleton);
                            obj.AddInteraction(OverridedFoodRegister.BuyCupOffCoffee.Singleton);

                            if (ShowBuyGroceries)
                            {
                                obj.AddInteraction(OverridedRegister.Buy.Singleton);
                            }
                        }
                        else if (obj.GetType() == typeof(ConcessionsStand))
                        {
                            //obj.RemoveInteractionByType(ConcessionsStand.Buy_FoodFromConcessionsStand.Singleton);
                            //obj.AddInteraction(OverridedBuyFoodFromConcessionsStand.SingletonConcessionsStand);
                        }
                        else
                        {
                            //Replace the original buy interaction
                            obj.RemoveInteractionByType(ShoppingRegister.Buy.Singleton);
                            obj.AddInteraction(OverridedRegister.Buy.Singleton);
                        }

                        if (ShowBuyFromInventory)
                        {
                            obj.AddInteraction(RegisterInteraction.ShopFromInventory.Singleton);
                        }
                    }
                }
                else
                {
                    //Call to meal should also be seen abroad.
                    if (obj.GetType() == typeof(FoodStoreRegister))
                    {
                        InteractionObjectPair i2 = new InteractionObjectPair(OverridedFoodRegister.CallForMeal.Singleton, obj);
                        if (!obj.Interactions.Contains(i2))
                        {
                            obj.AddInteraction(OverridedFoodRegister.CallForMeal.Singleton);
                        }
                    }
                }
            }
        }
        public static void RemoveMoveInteractions(GameObject gameObject, bool resetLocation)
        {
            if (MovedObjects.ContainsKey(gameObject))
            {
                if (resetLocation)
                {
                    LocationVectors vectors;
                    if (MovedObjects.TryGetValue(gameObject, out vectors))
                    {
                        gameObject.SetForward(vectors.ForwardVector);
                        gameObject.SetPosition(vectors.Position);
                    }
                }
                MovedObjects.Remove(gameObject);
            }
            gameObject.RemoveInteractionByType(StopMovingMe.Singleton);

            gameObject.RemoveInteractionByType(TurnLeft.Singleton);
            gameObject.RemoveInteractionByType(TurnAtAngle.Singleton);
            gameObject.RemoveInteractionByType(TurnRight.Singleton);
            gameObject.RemoveInteractionByType(TurnAround.Singleton);
            gameObject.RemoveInteractionByType(TiltFaceUp.Singleton);
            gameObject.RemoveInteractionByType(TiltBack.Singleton);
            gameObject.RemoveInteractionByType(TiltForward.Singleton);
            gameObject.RemoveInteractionByType(TiltFaceDown.Singleton);
            gameObject.RemoveInteractionByType(TiltUserDefined.Singleton);

            gameObject.RemoveInteractionByType(MoveUp.Singleton);
            gameObject.RemoveInteractionByType(MoveUpUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveDown.Singleton);
            gameObject.RemoveInteractionByType(MoveDownUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveBack.Singleton);
            gameObject.RemoveInteractionByType(MoveBackUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveForward.Singleton);
            gameObject.RemoveInteractionByType(MoveForwardUserDefined.Singleton);

            gameObject.RemoveInteractionByType(MoveRight.Singleton);
            gameObject.RemoveInteractionByType(MoveRightUserDefined.Singleton);
            gameObject.RemoveInteractionByType(MoveLeft.Singleton);
            gameObject.RemoveInteractionByType(MoveLeftUserDefined.Singleton);
        }
Exemplo n.º 12
0
 public static void ReplaceInteraction <DEF>(GameObject obj, InteractionDefinition newDef, bool checkForDup) where DEF : InteractionDefinition
 {
     obj.RemoveInteractionByType(typeof(DEF));
     obj.AddInteraction(newDef, checkForDup);
 }
Exemplo n.º 13
0
        public static void AddInteractions(GameObject obj)
        {
            //Grill grill = obj as Grill;
            //Stove stove = obj as Stove;
            //Fridge fridge = obj as Fridge;
            //Microwave micro = obj as Microwave;            
            //FoodProcessor processor = obj as FoodProcessor;

            if (obj != null && obj.Interactions != null)
            {
				if (obj is Fridge) //(fridge != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedFridge_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                   // {
						obj.RemoveInteractionByType(typeof(Fridge_Have.Definition));
						obj.RemoveInteractionByType (typeof(Fridge_Prepare.PrepareDefinition));
                       // obj.Interactions.RemoveAt(0);
                        obj.AddInteraction(OverridedFridge_Have.Singleton, true);
                        obj.AddInteraction(OverridedFridge_Prepare.PrepareSingleton, true);
                        
                    //}
                }
				else if (obj is Microwave)//(micro != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedMicrowave_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
						obj.RemoveInteractionByType (typeof(Microwave_Have.Definition));
                        obj.AddInteraction(OverridedMicrowave_Have.Singleton, true);

                    //}
                }
				else if (obj is FoodProcessor)//(processor != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedFoodProcessor_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
						obj.RemoveInteractionByType (typeof(FoodProcessor.FoodProcessor_Have.Definition));
                        obj.AddInteraction(OverridedFoodProcessor_Have.Singleton, true);
                    //}
                }
				else if (obj is Stove)//(stove != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedStove_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
						obj.RemoveInteractionByType (typeof(Stove_Have.Definition));
                        obj.AddInteraction(OverridedStove_Have.Singleton, true);
                    //}
                }
				else if (obj is Grill)//(grill != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedGrill_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
						obj.RemoveInteractionByType (typeof(Grill_Have.Definition));
                        obj.AddInteraction(OverridedGrill_Have.Singleton, true);
                    //}
                }

            }
        }