public FieldView( WaterWarsController controller, Scene scene, Field field, Vector3 scale, AbstractView itemStoreView) : base(controller, scene, itemStoreView) { m_field = field; m_scale = scale; }
public WaterAllocationDecorator( WaterWarsController controller, Scene scene, AbstractGameAsset asset, AbstractView itemStoreView, Vector3 positionToDisplay) : base(controller, scene, itemStoreView, IN_WORLD_NAME, positionToDisplay) { GameAsset = asset; Update(); GameAsset.OnChange += GameAssetChanged; }
public CropsView(WaterWarsController controller, Scene scene, AbstractGameAsset asset, AbstractView itemStoreView) : base(controller, scene, asset, itemStoreView) { m_veSceneObjectNames = new string[4, 1]; m_veSceneObjectNames[1, 0] = string.Format("{0}_Alfalfa", IN_WORLD_NAME); m_veSceneObjectNames[2, 0] = string.Format("{0}_Chillis", IN_WORLD_NAME); m_veSceneObjectNames[3, 0] = string.Format("{0}_Grapes", IN_WORLD_NAME); }
public FactoryView(WaterWarsController controller, Scene scene, AbstractGameAsset asset, AbstractView itemStoreView) : base(controller, scene, asset, itemStoreView) { m_veSceneObjectNames = new string[4, 2]; m_veSceneObjectNames[1, 0] = string.Format("{0}_Level-1-under-construction", IN_WORLD_NAME); m_veSceneObjectNames[2, 0] = string.Format("{0}_Level-2-under-construction", IN_WORLD_NAME); m_veSceneObjectNames[3, 0] = string.Format("{0}_Level-3-under-construction", IN_WORLD_NAME); m_veSceneObjectNames[1, 1] = string.Format("{0}_Level-1", IN_WORLD_NAME); m_veSceneObjectNames[2, 1] = string.Format("{0}_Level-2", IN_WORLD_NAME); m_veSceneObjectNames[3, 1] = string.Format("{0}_Level-3", IN_WORLD_NAME); }
public BuyPointView(WaterWarsController controller, Scene scene, AbstractView itemStoreView, BuyPoint bp) : base(controller, scene, itemStoreView) { m_bp = bp; m_bp.OnChange += Update; m_veSceneObjectNames[AbstractGameAssetType.None] = "For Sale"; m_veSceneObjectNames[AbstractGameAssetType.Crops] = "Farmhouse"; m_veSceneObjectNames[AbstractGameAssetType.Houses] = "Site Office"; m_veSceneObjectNames[AbstractGameAssetType.Factory] = "Portacabin"; }
/// <summary> /// Get the appropriate inventory item /// </summary> /// <param name="newObjectContainer"></param> /// <param name="newObjectName"></param> /// <returns></returns> protected TaskInventoryItem GetItem(AbstractView newObjectContainer, string newObjectName) { SceneObjectPart part = newObjectContainer.RootPart; IList <TaskInventoryItem> items = part.Inventory.GetInventoryItems(newObjectName); if (items.Count == 0) { throw new Exception(string.Format("Could not find scene object with name {0} to initialize", newObjectName)); } else if (items.Count > 1) { m_log.ErrorFormat( "[WATER WARS]: Unexpectedly found {0} {1} items in {2}", items.Count, newObjectName, part.Name); } return(items[0]); }
public override void ChangeSceneObject(AbstractView newObjectContainer, string newObjectName) { base.ChangeSceneObject(newObjectContainer, newObjectName); m_button.ResetButtonPrims(); }
/// <summary> /// Change the scene object in-world that represents this view. /// </summary> public virtual void ChangeSceneObject(AbstractView newObjectContainer, string newObjectName) { SceneObjectGroup group = RootPart.ParentGroup; // m_log.InfoFormat( // "[WATER WARS]: Entering AbstractView.ChangeSceneObject to change object {0} to {1}", // group.Name, newObjectName); // delete everything except the root prim // m_log.InfoFormat( // "[WATER WARS]: Deleting {0} old prims from {1}", // originalParts.Count, group.Name); foreach (SceneObjectPart part in group.Parts) { if (!part.IsRoot) { SceneObjectGroup groupToDelete = group.DelinkFromGroup(part, false); m_scene.DeleteSceneObject(groupToDelete, false); } } // Super-annoying pause to avoid ghost objects where a final update comes in after the kill command // FIXME: Really need a better way of ensuring that this problem doesn't happen //System.Threading.Thread.Sleep(1000); // get the new thing that we want to look like AssetBase objectAsset = m_scene.AssetService.Get(GetItem(newObjectContainer, newObjectName).AssetID.ToString()); string xml = Utils.BytesToString(objectAsset.Data); SceneObjectGroup sogToCopy = SceneObjectSerializer.FromOriginalXmlFormat(xml); // change the name of the morphed group to reflect its new identity group.Name = sogToCopy.Name; // change the shape of the root prim group.RootPart.Shape = sogToCopy.RootPart.Shape; // m_log.InfoFormat( // "[WATER WARS]: Adding {0} prims as part of change from {1} to {2}", // sogToCopy.Children.Count, group.Name, newObjectName); // create all the linked parts of the morph foreach (SceneObjectPart part in sogToCopy.Parts) { if (!part.IsRoot) { part.UUID = UUID.Random(); // This is necessary to stop inventory item IDs being identical and failing persistence. part.Inventory.ResetInventoryIDs(); part.LocalId = m_scene.AllocateLocalId(); part.ParentID = group.RootPart.LocalId; part.ParentUUID = group.RootPart.UUID; group.AddPart(part); } } // XXX: Nasty nasty nasty group.HasGroupChanged = true; group.ScheduleGroupForFullUpdate(); }
/// <summary> /// Get the appropriate inventory item /// </summary> /// <param name="newObjectContainer"></param> /// <param name="newObjectName"></param> /// <returns></returns> protected TaskInventoryItem GetItem(AbstractView newObjectContainer, string newObjectName) { SceneObjectPart part = newObjectContainer.RootPart; IList<TaskInventoryItem> items = part.Inventory.GetInventoryItems(newObjectName); if (items.Count == 0) throw new Exception(string.Format("Could not find scene object with name {0} to initialize", newObjectName)); else if (items.Count > 1) m_log.ErrorFormat( "[WATER WARS]: Unexpectedly found {0} {1} items in {2}", items.Count, newObjectName, part.Name); return items[0]; }
public GameAssetView(WaterWarsController controller, Scene scene, AbstractGameAsset asset, AbstractView itemStoreView) : base(controller, scene, itemStoreView) { GameAsset = asset; }
public WaterWarsView(WaterWarsController controller, Scene scene, AbstractView itemStoreView) : this(controller, scene) { m_itemStoreView = itemStoreView; }
public HousesView(WaterWarsController controller, Scene scene, AbstractGameAsset asset, AbstractView itemStoreView) : base(controller, scene, asset, itemStoreView) { m_veSceneObjectNames = new string[4, 2]; m_veSceneObjectNames[1, 0] = string.Format("{0}_Level-1-under-construction", IN_WORLD_NAME); m_veSceneObjectNames[2, 0] = string.Format("{0}_Level-2-under-construction", IN_WORLD_NAME); m_veSceneObjectNames[3, 0] = string.Format("{0}_Level-3-under-construction", IN_WORLD_NAME); m_veSceneObjectNames[1, 1] = string.Format("{0}_Level-1", IN_WORLD_NAME); m_veSceneObjectNames[2, 1] = string.Format("{0}_Level-2", IN_WORLD_NAME); m_veSceneObjectNames[3, 1] = string.Format("{0}_Level-3", IN_WORLD_NAME); }