// -------------------------------------------------------------------------------
        protected override void ThrottledUpdate()
        {
            if (manager == null)
            {
                manager = localPlayer.GetComponent <EquipmentManager>();
            }

            for (int i = 0; i < contentGroup.childCount; i++)
            {
                GameObject.Destroy(contentGroup.GetChild(i).gameObject);
            }

            foreach (EquipmentSyncStruct _entry in manager.GetEntries(true, SortOrder.None, category))
            {
                EquipmentSyncStruct entry  = _entry;
                GameObject          prefab = null;

                if (displayType == DisplayType.Horizontal)
                {
                    prefab = horizontalSlotPrefab.gameObject;
                }
                else if (displayType == DisplayType.Vertical)
                {
                    prefab = verticalSlotPrefab.gameObject;
                }
                else if (displayType == DisplayType.Grid)
                {
                    prefab = gridSlotPrefab.gameObject;
                }

                GameObject go = GameObject.Instantiate(prefab);
                go.transform.SetParent(contentGroup, false);
                go.GetComponent <UIPlayerListEquipmentSlot>().Init(localPlayer, ref entry);
            }
        }
예제 #2
0
        protected override void SellEntry(int _index, long _amount)
        {
            EquipmentSyncStruct entry = syncEquipment[_index];

            entry.Remove(_amount);
            syncEquipment[_index] = entry;

            GetComponentInParent <CurrencyManager>().AddCurrency(entry.template.sellCost, entry.level);
        }
        public void SaveData_Equipment(GameObject player)
        {
            connection.Execute("DELETE FROM c2w_equipment WHERE owner=?", player.name);

            EquipmentManager manager = player.GetComponent <EquipmentManager>();

            List <EquipmentSyncStruct> list = manager.GetEntries(false);

            for (int i = 0; i < list.Count; i++)
            {
                EquipmentSyncStruct entry = list[i];

                connection.InsertOrReplace(new c2w_equipment {
                    owner = player.name,
                    slot  = entry.slot,
                    name  = entry.name,
                    level = entry.level,
                    state = entry.state,
                    timer = entry.timer
                });
            }
        }
        public void AddEntry(int _slot, EquipmentTemplate _template, byte _state, double _timer, int _level)
        {
            EquipmentSyncStruct syncStruct = new EquipmentSyncStruct(_slot, _template, _state, _timer, _level);

            syncEquipment.Add(syncStruct);
        }