コード例 #1
0
ファイル: Inventory.cs プロジェクト: vvnurmi/MOOLGOSS
 public Inventory(string name, float x, float y, int slotCount, int slotCountX, InventoryModel model)
 {
     _name = name;
     _slotCount = slotCount;
     _inventory = OverlayManager.Instance.Create("Overlays/Inventory/" + _name);
     _model = model;
     _modelChangeTimestamp = -1;
     var inventoryElement = CreateOverlayElementContainer(x, y, slotCountX);
     _inventory.AddElement(inventoryElement);
 }
コード例 #2
0
ファイル: Gameplay.cs プロジェクト: vvnurmi/MOOLGOSS
        private void EnterHandler()
        {
            Globals.UI.HideMouse();

            if (_inventory == null)
            {
                _inventory = new InventoryModel(Guid.NewGuid())
                    .Add(new Core.Items.ItemStack(Guid.NewGuid(), Core.Items.ItemType.MiningDroid, 2)); // !!!
                Globals.World.Set(w => w.SetWob(_inventory));
                _inventoryView = new InventoryView("Player", 10, 10, 28, 5, _inventory);
            }

            if (_topBarView == null)
            {
                _topBarView = new TopBar("Space", "The Ancient Sector : First Space Station");
            }

            _topBarView.AddButton("dock", "DOCK (F1)", TryDocking);

            if (Globals.PlayerID == Guid.Empty)
            {
                Globals.PlayerID = Guid.NewGuid();
                var shipID = Guid.NewGuid();
                Globals.World.Set(w => w
                    .SetPlayerShipID(Globals.PlayerID, shipID)
                    .SetWob(new Ship(shipID, new Pose(Vector3.Zero, Vector3.UnitX, Vector3.UnitY))));
            }

            if (_shipUpdateHandle == null)
            {
                _shipUpdateHandle = new Action(SyncWithServerLoop).BeginInvoke(null, null);
            }

            if (_visualization == null)
            {
                _visualization = new SpaceVisualization();
                _visualization.CreateStaticThings();
            }
        }