Exemple #1
0
        public void UpdateFurniture(DeckModel deckModel, FurnitureKinds furnitureKind, FurnitureModel changeToFurniture)
        {
            UIFurniture uIFurniture = UserInterfacePortInteriorManager.UIPortInteriorFactory.GenerateFurniturePrefab(changeToFurniture);

            UIFurniture.UIFurnitureModel uiFurnitureModel = new UIFurniture.UIFurnitureModel(changeToFurniture, deckModel);
            UIFurniture uIFurniture2 = null;

            switch (furnitureKind)
            {
            case FurnitureKinds.Floor:
                this.ClearFurniture(this.mFloor);
                uIFurniture2 = NGUITools.AddChild(this.mFloor.get_gameObject(), uIFurniture.get_gameObject()).GetComponent <UIFurniture>();
                uIFurniture2.Initialize(uiFurnitureModel);
                break;

            case FurnitureKinds.Wall:
                this.ClearFurniture(this.mWall);
                uIFurniture2 = NGUITools.AddChild(this.mWall.get_gameObject(), uIFurniture.get_gameObject()).GetComponent <UIFurniture>();
                uIFurniture2.Initialize(uiFurnitureModel);
                break;

            case FurnitureKinds.Window:
                this.ClearFurniture(this.mWindow);
                uIFurniture2 = NGUITools.AddChild(this.mWindow.get_gameObject(), uIFurniture.get_gameObject()).GetComponent <UIFurniture>();
                uIFurniture2.Initialize(uiFurnitureModel);
                break;

            case FurnitureKinds.Hangings:
                this.ClearFurniture(this.mHangings);
                uIFurniture2 = NGUITools.AddChild(this.mHangings.get_gameObject(), uIFurniture.get_gameObject()).GetComponent <UIFurniture>();
                uIFurniture2.Initialize(uiFurnitureModel);
                break;

            case FurnitureKinds.Chest:
                this.ClearFurniture(this.mChest);
                uIFurniture2 = NGUITools.AddChild(this.mChest.get_gameObject(), uIFurniture.get_gameObject()).GetComponent <UIFurniture>();
                uIFurniture2.Initialize(uiFurnitureModel);
                break;

            case FurnitureKinds.Desk:
                this.ClearFurniture(this.mDesk);
                uIFurniture2 = NGUITools.AddChild(this.mDesk.get_gameObject(), uIFurniture.get_gameObject()).GetComponent <UIFurniture>();
                uIFurniture2.Initialize(uiFurnitureModel);
                break;
            }
            bool flag = uIFurniture2.GetComponent <UIDynamicFurniture>() != null;

            if (flag)
            {
                uIFurniture2.GetComponent <UIDynamicFurniture>().SetOnActionEvent(new Action <UIDynamicFurniture>(this.OnFurnitureActionEvent));
            }
        }
        public void UpdateFurniture(DeckModel deckModel, FurnitureKinds furnitureKind, FurnitureModel changeToFurniture)
        {
            UIFurniture uIFurniture = UIPortInteriorFactory.GenerateFurniturePrefab(changeToFurniture);

            UIFurniture.UIFurnitureModel uiFurnitureModel = new UIFurniture.UIFurnitureModel(changeToFurniture, deckModel);
            UIFurniture uIFurniture2 = null;

            switch (furnitureKind)
            {
            case FurnitureKinds.Window:
                ClearFurniture(mWindow);
                uIFurniture2 = NGUITools.AddChild(mWindow.gameObject, uIFurniture.gameObject).GetComponent <UIFurniture>();
                uIFurniture2.Initialize(uiFurnitureModel);
                break;

            case FurnitureKinds.Floor:
                ClearFurniture(mFloor);
                uIFurniture2 = NGUITools.AddChild(mFloor.gameObject, uIFurniture.gameObject).GetComponent <UIFurniture>();
                uIFurniture2.Initialize(uiFurnitureModel);
                break;

            case FurnitureKinds.Wall:
                ClearFurniture(mWall);
                uIFurniture2 = NGUITools.AddChild(mWall.gameObject, uIFurniture.gameObject).GetComponent <UIFurniture>();
                uIFurniture2.Initialize(uiFurnitureModel);
                break;

            case FurnitureKinds.Hangings:
                ClearFurniture(mHangings);
                uIFurniture2 = NGUITools.AddChild(mHangings.gameObject, uIFurniture.gameObject).GetComponent <UIFurniture>();
                uIFurniture2.Initialize(uiFurnitureModel);
                break;

            case FurnitureKinds.Chest:
                ClearFurniture(mChest);
                uIFurniture2 = NGUITools.AddChild(mChest.gameObject, uIFurniture.gameObject).GetComponent <UIFurniture>();
                uIFurniture2.Initialize(uiFurnitureModel);
                break;

            case FurnitureKinds.Desk:
                ClearFurniture(mDesk);
                uIFurniture2 = NGUITools.AddChild(mDesk.gameObject, uIFurniture.gameObject).GetComponent <UIFurniture>();
                uIFurniture2.Initialize(uiFurnitureModel);
                break;
            }
            if (uIFurniture2.GetComponent <UIDynamicFurniture>() != null)
            {
                uIFurniture2.GetComponent <UIDynamicFurniture>().SetOnActionEvent(OnFurnitureActionEvent);
            }
        }