コード例 #1
0
ファイル: FruitTree.cs プロジェクト: poisonlogic/Village
        public FruitTree(BuildingDef def, string layerName, MapSpot anchor, IMapController controller, MapRotation rotation) : base(def, layerName, anchor, controller, rotation)
        {
            _stageLengths = new List <Dictionary <string, int> >();
            _stageLengths.Add(new Dictionary <string, int> {
                { "HOUR", 1 }
            });
            _stageLengths.Add(new Dictionary <string, int> {
                { "HOUR", 1 }
            });
            _stageLengths.Add(new Dictionary <string, int> {
                { "HOUR", 1 }
            });

            var outputConfif = new InventoryConfig()
            {
                CanProvideItems    = true,
                CanReceiveItems    = false,
                HasMassLimit       = false,
                MaxMass            = -1,
                RespectsStackLimit = false
            };

            var timeKeeper = GameMaster.Instance.GetController <ITimeKeeper>();

            _timeKeeper      = timeKeeper;
            _finishDate      = timeKeeper.ProjectTime(_stageLengths[0]);
            _outputInventory = new DefaultInventory(GameMaster.Instance.GetController <IItemController>(), this, outputConfif);
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: VisionSim/Vision-Sim-NXG
        protected override void StartupSpecific()
        {
            InventoryConfig config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml")));

            m_inventoryService          = new GridInventoryService(config.UserServerURL);
            m_inventoryService.DoLookup = config.SessionLookUp;
            m_inventoryService.AddPlugin(config.DatabaseProvider, config.DatabaseConnect);


            m_log.Info("[" + LogName + "]: Starting HTTP server ...");

            m_httpServer = new BaseHttpServer(config.HttpPort);

            AddHttpHandlers(config.RegionAccessToAgentsInventory);

            m_httpServer.Start();

            m_log.Info("[" + LogName + "]: Started HTTP server");

            new HGInventoryService(m_inventoryService, config.AssetServerURL, config.UserServerURL, m_httpServer, config.InventoryServerURL);

            base.StartupSpecific();

            m_console.Commands.AddCommand("inventoryserver", false, "add user",
                                          "add user",
                                          "Add a random user inventory", HandleAddUser);
        }
コード例 #3
0
 public void Init()
 {
     gameConfig = ConfigManager.main.GetConfig("GameConfig") as GameConfig;
     config     = ConfigManager.main.GetConfig("InventoryConfig") as InventoryConfig;
     config.Init(gameStart);
     UIShop.main.DisplayItems(config);
     gameStart = false;
 }
コード例 #4
0
 public void setInventoryConfig(InventoryConfig config)
 {
     inventoryconfig.startTrigger  = config.startTrigger;
     inventoryconfig.stopTrigger   = config.stopTrigger;
     inventoryconfig.AITriggerType = config.AITriggerType;
     inventoryconfig.duration      = config.duration;
     inventoryconfig.numAttempts   = config.numAttempts;
     inventoryconfig.numTags       = config.numTags;
     inventoryconfig.reportTrigger = config.reportTrigger;
     inventoryconfig.reportN       = config.reportN;
     inventoryconfig.AITimeout     = config.AITimeout;
 }
コード例 #5
0
ファイル: InventoryModule.cs プロジェクト: gdn002/TosserWorld
        protected override void OnInitialize(ModuleConfiguration configuration)
        {
            if (InventoryPrefab == null)
            {
                InventoryPrefab = Resources.Load <GameObject>(DEFAULT_INVENTORY_PREFAB).GetComponent <UIInventory>();
            }

            InventoryConfig containerConfig = configuration as InventoryConfig;

            Rows = containerConfig.Rows;
            Cols = containerConfig.Cols;

            Storage = new InventorySpace(SlotCount);
        }
コード例 #6
0
ファイル: BaseInventory.cs プロジェクト: poisonlogic/Village
        public BaseInventory(IItemController controller, IInventoryUser user, InventoryConfig config)
        {
            InventoryId = Guid.NewGuid().ToString();
            _items      = new Dictionary <string, IItemInstance>();
            Controller  = controller ?? throw new ArgumentNullException(nameof(controller));
            _user       = user ?? throw new ArgumentNullException(nameof(user));
            Config      = config ?? throw new ArgumentNullException(nameof(config));
            _filterIds  = new List <string>();

            if (Config.ItemFilterConfig != null)
            {
                _filterIds.Add(Controller.CreateFilterFromConfig(Config.ItemFilterConfig));
            }
            Controller.RegisterNewInventory(this);
        }
コード例 #7
0
        public void Initialize(InventoryConfig inventoryConfig)
        {
            _slots = new InventorySlotView[inventoryConfig.Rows, inventoryConfig.Columns];

            for (var i = 0; i < inventoryConfig.Rows; i++)
            {
                for (var j = 0; j < inventoryConfig.Columns; j++)
                {
                    var slotView = Instantiate(
                        inventorySlotViewPrefab,
                        inventorySlotsContainer.transform
                        );
                    var inventorySlotView = slotView.GetComponent <InventorySlotView>();
                    inventorySlotView.Reset();
                    _slots[i, j] = inventorySlotView;
                }
            }
        }
        /// <summary>
        /// 初始化库存grid
        /// </summary>
        public void InitInventoryTable(DataGridView dv, int[] idAry)
        {
            InventoryConfig client = new InventoryConfig();

            _inventoryTable = new DataTable();
            _inventoryTable.Columns.Add(client.Oid, typeof(string));          //0
            _inventoryTable.Columns.Add(client.Material, typeof(Int32));      //1
            _inventoryTable.Columns.Add(client.MaterialCode, typeof(string)); //2
            _inventoryTable.Columns.Add(client.MaterialName, typeof(string)); //3
            _inventoryTable.Columns.Add(client.SupplierCode, typeof(string)); //4
            _inventoryTable.Columns.Add(client.SupplierName, typeof(string)); //5
            _inventoryTable.Columns.Add(client.SysInventory, typeof(Int32));  //6
            _inventoryTable.Columns.Add(client.Min, typeof(Int32));           //7
            _inventoryTable.Columns.Add(client.Max, typeof(Int32));           //8
            _inventoryTable.Columns.Add(client.HUB, typeof(Int32));           //9
            _inventoryTable.Columns.Add(client.InTransit, typeof(Int32));     //10
            _inventoryTable.Columns.Add(client.Total, typeof(Int32));         //10
            BindGrid(dv, _inventoryTable, idAry);
        }
コード例 #9
0
ファイル: UIShop.cs プロジェクト: bradur/LD44
 public void DisplayItems(InventoryConfig inventoryConfig)
 {
     HideNextLevelButton();
     foreach (UIShopItem item in items)
     {
         if (item != null)
         {
             Destroy(item.gameObject);
         }
     }
     foreach (InventoryItem item in inventoryConfig.AvailableItems)
     {
         UIShopItem uiShopItem = Instantiate(config.UIShopItemPrefab);
         uiShopItem.Init(item);
         uiShopItem.SetParent(uiShopItemContainer);
         items.Add(uiShopItem);
     }
     SetCurrency(inventoryConfig.Currency);
 }
コード例 #10
0
ファイル: ReaderManager.cs プロジェクト: pengyuzhang/Blink
 public void setInventoryConfig(InventoryConfig config)
 {
     inventoryconfig.startTrigger = config.startTrigger;
     inventoryconfig.stopTrigger = config.stopTrigger;
     inventoryconfig.AITriggerType = config.AITriggerType;
     inventoryconfig.duration = config.duration;
     inventoryconfig.numAttempts = config.numAttempts;
     inventoryconfig.numTags = config.numTags;
     inventoryconfig.reportTrigger = config.reportTrigger;
     inventoryconfig.reportN = config.reportN;
     inventoryconfig.AITimeout = config.AITimeout;
 }
コード例 #11
0
        static void RunGame(EventExchange global, string baseDir)
        {
            PerfTracker.StartupEvent("Creating engine");
            using var engine = new Engine(_backend, _useRenderDoc)
                               .AddRenderer(new SpriteRenderer())
                               .AddRenderer(new ExtrudedTileMapRenderer())
                               .AddRenderer(new FullScreenQuad())
                               .AddRenderer(new DebugGuiRenderer())
                               .AddRenderer(new ScreenDuplicator())
            ;

            global
            .Register <IShaderCache>(new ShaderCache(
                                         Path.Combine(baseDir, "Core", "Visual", "Shaders"),
                                         Path.Combine(baseDir, "data", "ShaderCache")))
            .Register <IEngine>(engine);

            var backgroundThreadInitTask = Task.Run(() =>
            {
                PerfTracker.StartupEvent("Creating main components");
                global
                .Register <IInputManager>(new InputManager()
                                          .RegisterInputMode(InputMode.ContextMenu, new ContextMenuInputMode())
                                          .RegisterInputMode(InputMode.World2D, new World2DInputMode())
                                          .RegisterMouseMode(MouseMode.DebugPick, new DebugPickMouseMode())
                                          .RegisterMouseMode(MouseMode.Exclusive, new ExclusiveMouseMode())
                                          .RegisterMouseMode(MouseMode.MouseLook, new MouseLookMouseMode())
                                          .RegisterMouseMode(MouseMode.Normal, new NormalMouseMode())
                                          )
                .Register <ILayoutManager>(new LayoutManager())
                .Register <IMapManager>(new MapManager())
                .Register <IPaletteManager>(new PaletteManager())
                .Register <ISceneManager>(new SceneManager()
                                          .AddScene(new EmptyScene())
                                          .AddScene(new AutomapScene())
                                          .AddScene(new FlatScene())
                                          .AddScene(new DungeonScene())
                                          .AddScene(new MenuScene())
                                          .AddScene(new InventoryScene())
                                          )
                .Register <IClock>(new GameClock())
                .Register <ISpriteManager>(new SpriteManager())
                .Register <IGameState>(new GameState())
                .Register <ITextManager>(new TextManager())
                .Register <ITextureManager>(new TextureManager())
                .Register <IDeviceObjectManager>(new DeviceObjectManager())
                .Attach(new SlowClock())
                .Attach(new CursorManager())
                .Attach(new DebugMapInspector()
                        .AddBehaviour(new SpriteInstanceDataDebugBehaviour()))
                .Attach(new InputBinder(InputConfig.Load(baseDir)))
                .Attach(new InputModeStack())
                .Attach(new MouseModeStack())
                .Attach(new SceneStack())
                .Attach(new StatusBar())
                ;

                PerfTracker.StartupEvent("Creating scene-specific components");
                var inventoryConfig = InventoryConfig.Load(baseDir);
                global.Resolve <ISceneManager>().GetExchange(SceneId.Inventory)
                .Attach(new InventoryScreen(inventoryConfig))
                ;

                var menuBackground = Sprite <PictureId> .ScreenSpaceSprite(
                    PictureId.MenuBackground8,
                    new Vector2(-1.0f, 1.0f),
                    new Vector2(2.0f, -2.0f));

                global.Resolve <ISceneManager>().GetExchange(SceneId.MainMenu)
                .Attach(new MainMenu())
                .Attach(menuBackground)
                ;

                PerfTracker.StartupEvent("Starting new game");
                //global.Raise(new LoadMapEvent(MapDataId.Jirinaar3D), null); /*

                /*
                 * global.Raise(new LoadMapEvent(MapDataId.AltesFormergebäude), null); /*
                 * global.Raise(new LoadMapEvent(MapDataId.HausDesJägerclans), null); //*/
                /*
                 * global.Raise(new SetSceneEvent(SceneId.Inventory), null);
                 * //*/

                global.Raise(new SetSceneEvent(SceneId.MainMenu), null);
                //global.Raise(new NewGameEvent(), null);
                ReflectionHelper.ClearTypeCache();
            });

            engine.Initialise();
            backgroundThreadInitTask.Wait();

            PerfTracker.StartupEvent("Running game");
            if (_startupOnly)
            {
                global.Raise(new QuitEvent(), null);
            }

            engine.Run();
            // TODO: Ensure all sprite leases returned etc to weed out memory leaks
        }
コード例 #12
0
 public PlayerConfig(float speed, InventoryConfig inventoryConfig)
 {
     Speed           = speed;
     InventoryConfig = inventoryConfig;
 }
コード例 #13
0
 public InventoryScreen(InventoryConfig config) : base(Handlers, DialogPositioning.Bottom)
 {
     _config = config;
 }
コード例 #14
0
ファイル: Unit.cs プロジェクト: redditemblem/RedditEmblemAPI
        private void BuildInventory(IList <string> data, InventoryConfig config, IDictionary <string, Item> items, IList <string> weaponRanks, IList <WeaponRankBonus> weaponRankBonuses)
        {
            this.Inventory = new List <UnitInventoryItem>();

            foreach (int index in config.Slots)
            {
                string name = ParseHelper.SafeStringParse(data, index, "Item Name", false);
                if (string.IsNullOrEmpty(name))
                {
                    this.Inventory.Add(null);
                    continue;
                }
                UnitInventoryItem item = new UnitInventoryItem(name, items);

                //Check if the item can be equipped
                string unitRank;
                if (this.WeaponRanks.TryGetValue(item.Item.Category, out unitRank))
                {
                    if (string.IsNullOrEmpty(unitRank) ||
                        string.IsNullOrEmpty(item.Item.WeaponRank) ||
                        weaponRanks.IndexOf(unitRank) >= weaponRanks.IndexOf(item.Item.WeaponRank))
                    {
                        item.CanEquip = true;
                    }
                }
                else if (string.IsNullOrEmpty(item.Item.WeaponRank) && !item.Item.UtilizedStats.Any())
                {
                    item.CanEquip = true;
                }

                this.Inventory.Add(item);
            }

            //Find the equipped item and flag it
            string equippedItemName = ParseHelper.SafeStringParse(data, config.EquippedItem, "Equipped Item", false);

            if (!string.IsNullOrEmpty(equippedItemName))
            {
                UnitInventoryItem equipped = this.Inventory.FirstOrDefault(i => i != null && i.FullName == equippedItemName);
                if (equipped == null)
                {
                    throw new UnmatchedEquippedItemException(equippedItemName);
                }
                equipped.IsEquipped = true;

                //Apply equipped stat modifiers
                foreach (string stat in equipped.Item.EquippedStatModifiers.Keys)
                {
                    ModifiedStatValue mods;
                    if (!this.Stats.General.TryGetValue(stat, out mods))
                    {
                        throw new UnmatchedStatException(stat);
                    }
                    mods.Modifiers.Add($"{equipped.Item.Name} (Eqp)", equipped.Item.EquippedStatModifiers[stat]);
                }

                //Check if we need to apply weapon rank bonuses for the equipped item
                if (this.WeaponRanks.ContainsKey(equipped.Item.Category))
                {
                    string unitRank;
                    this.WeaponRanks.TryGetValue(equipped.Item.Category, out unitRank);

                    WeaponRankBonus bonus = weaponRankBonuses.FirstOrDefault(b => b.Category == equipped.Item.Category && b.Rank == unitRank);
                    if (bonus != null)
                    {
                        foreach (string stat in bonus.CombatStatModifiers.Keys)
                        {
                            ModifiedStatValue mods;
                            if (!this.Stats.Combat.TryGetValue(stat, out mods))
                            {
                                throw new UnmatchedStatException(stat);
                            }
                            mods.Modifiers.Add($"{equipped.Item.Category} {unitRank} Rank Bonus", bonus.CombatStatModifiers[stat]);
                        }

                        foreach (string stat in bonus.StatModifiers.Keys)
                        {
                            ModifiedStatValue mods;
                            if (!this.Stats.General.TryGetValue(stat, out mods))
                            {
                                throw new UnmatchedStatException(stat);
                            }
                            mods.Modifiers.Add($"{equipped.Item.Category} {unitRank} Rank Bonus", bonus.StatModifiers[stat]);
                        }
                    }
                }
            }

            //Apply inventory stat modifiers for all nonequipped items
            foreach (UnitInventoryItem inv in this.Inventory.Where(i => i != null && !i.IsEquipped))
            {
                foreach (string stat in inv.Item.InventoryStatModifiers.Keys)
                {
                    ModifiedStatValue mods;
                    if (!this.Stats.General.TryGetValue(stat, out mods))
                    {
                        throw new UnmatchedStatException(stat);
                    }
                    mods.Modifiers.Add($"{inv.Item.Name} (Inv)", inv.Item.InventoryStatModifiers[stat]);
                }
            }
        }