Esempio n. 1
0
        /// <summary>
        /// Create a game asset view
        /// </summary>
        /// <param name="asset"></param>
        /// <returns>A view that doesn't have a link to the model.  The caller needs to link this subsequently</returns>
        public GameAssetView CreateGameAssetView(AbstractGameAsset asset)
        {
            GameAssetView v   = null;
            FieldView     fv  = m_fieldViews[asset.Field.Uuid];
            Vector3       pos = fv.RootPart.AbsolutePosition;

            if (asset.Type == AbstractGameAssetType.Factory)
            {
                v = new FactoryView(m_controller, m_scene, asset, m_itemStoreView);
            }
            else if (asset.Type == AbstractGameAssetType.Houses)
            {
                v = new HousesView(m_controller, m_scene, asset, m_itemStoreView);
            }
            else if (asset.Type == AbstractGameAssetType.Crops)
            {
                v = new CropsView(m_controller, m_scene, asset, m_itemStoreView);
            }
            else
            {
                throw new Exception(string.Format("Unrecognized asset type {0} at position {1}", asset.Type, pos));
            }

            fv.Close();
            m_fieldViews.Remove(asset.Field.Uuid);

            v.Initialize(pos);

            return(v);
        }
Esempio n. 2
0
            public GameAssetButton(WaterWarsController controller, SceneObjectPart part, GameAssetView gav)
                : base(controller, part, new FixedTextureBehaviour())
            {
                m_gav = gav;

                Enabled = true;
                OnClick
                    += delegate(Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
                    { Util.FireAndForget(
                          delegate {
                        m_controller.ViewerWebServices.PlayerServices.SetLastSelected(
                            remoteClient.AgentId, m_gav.GameAsset);
                    }); };

                m_controller.EventManager.OnGameAssetBuildStarted   += OnGameAssetBuildStarted;
                m_controller.EventManager.OnGameAssetBuildCompleted += OnGameAssetBuildCompleted;
                m_controller.EventManager.OnGameAssetUpgraded       += OnGameAssetUpgraded;
                m_controller.EventManager.OnGameAssetSoldToEconomy  += OnGameAssetSoldToEconomy;
            }