Esempio n. 1
0
    void Awake()
    {
        if(instance == null)
            instance = this;
        else if(instance != this)
            Destroy (gameObject);

        DontDestroyOnLoad(gameObject);
    }
Esempio n. 2
0
 public void ClickItem(ItemDB.Item item)
 {
     int id = IdentificaItem(item.ID);
     if (id == 2)
     {
         Gameplay.Inst.itemswitch(2);
     }
     if (id == 1)
     {
         Gameplay.Inst.itemswitch(1);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     ItemDB idb = new ItemDB();
     List<Item> items = new List<Item>();
     items = (List<Item>)idb.getItems();
     if (items[0] == null)
     {
         lblInfo.Text = "null";
     }
     else
     {
     lblInfo.Text = items[0].name;
     }
 }
Esempio n. 4
0
        public ItemDB GetOption()
        {
            ItemDB option = new ItemDB();
            int    atk    = 0;
            double hp     = 0.0;
            double damage = 0.0;

            for (int i = 0; i < List[(int)MEDAL_ENUM.VALOR]; i++)
            {
                atk += MedalTable.Get_ATK_MATK(i);
            }
            option.Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.ATK)]  = atk;
            option.Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.MATK)] = atk;

            for (int i = 0; i <= List[(int)MEDAL_ENUM.GUARDIAN]; i++)
            {
                hp     += MedalTable.Get_MaxHP(i);
                damage += MedalTable.Get_P_M_Damage(i);
            }
            option.Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.HP)] = (int)hp;
            option.Option_DTYPE[Enum.GetName(typeof(DTYPE), DTYPE.PHYSICAL_DAMAGE)] = damage;

            hp     = 0;
            damage = 0.0;
            for (int i = 0; i <= List[(int)MEDAL_ENUM.WISDOM]; i++)
            {
                hp     += MedalTable.Get_MaxHP(i);
                damage += MedalTable.Get_P_M_Damage(i);
            }
            option.Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.HP)]            += (int)hp;
            option.Option_DTYPE[Enum.GetName(typeof(DTYPE), DTYPE.MAGICAL_DAMAGE)] = damage;

            damage = 0.0;
            for (int i = 0; i <= List[(int)MEDAL_ENUM.CHARM]; i++)
            {
                damage += MedalTable.Get_Dec_Damage(i);
            }
            option.Option_DTYPE[Enum.GetName(typeof(DTYPE), DTYPE.PHYSICAL_DEC_DAMAGE)] = damage;

            damage = 0.0;
            for (int i = 0; i <= List[(int)MEDAL_ENUM.GALE]; i++)
            {
                damage += MedalTable.Get_Dec_Damage(i);
            }
            option.Option_DTYPE[Enum.GetName(typeof(DTYPE), DTYPE.MAGICAL_DEC_DAMAGE)] = damage;

            return(option);
        }
Esempio n. 5
0
        public void TestMergeDB()
        {
            ItemDB.Merge("TestItems.xml");
            ItemDB.Index();

            Assert.AreEqual(5, ItemDB.AttributesOf("TestGem", 5, 0)["Attribute1: #"][0]);
            Assert.AreEqual(10, ItemDB.AttributesOf("TestGem", 10, 0)["Attribute1: #"][0]);

            ItemDB.Merge("TestMerge.xml");
            ItemDB.Index();

            // Attribute1: <Value Level="5">21</Value> <ValuePerLevel>5</ValuePerLevel>
            Assert.AreEqual(21, ItemDB.AttributesOf("TestGem", 5, 0)["Attribute1: #"][0], "Level 5");
            Assert.AreEqual(45, ItemDB.AttributesOf("TestGem", 10, 0)["Attribute1: #"][0], "Level 10");
            // Attribute2: <Value Level="5">5</Value> <Value Level="6">7</Value> <ValueForLevel From="1" To="10">10</ValueForLevel>
            Assert.AreEqual(10, ItemDB.AttributesOf("TestGem", 1, 0)["Attribute2: #"][0], "Level 1");
            Assert.AreEqual(6, ItemDB.AttributesOf("TestGem", 5, 0)["Attribute2: #"][0], "Level 5");
            Assert.AreEqual(7, ItemDB.AttributesOf("TestGem", 6, 0)["Attribute2: #"][0], "Level 6");
            Assert.AreEqual(10, ItemDB.AttributesOf("TestGem", 10, 0)["Attribute2: #"][0], "Level 10");
            // Attribute3: <Value Level="5">5</Value> <ValueForLevel From="1" To="7">10</ValueForLevel> <ValueForLevel From="8" To="15">15</ValueForLevel>
            Assert.AreEqual(10, ItemDB.AttributesOf("TestGem", 1, 0)["Attribute3: #"][0], "Level 1");
            Assert.AreEqual(5, ItemDB.AttributesOf("TestGem", 5, 0)["Attribute3: #"][0], "Level 5");
            Assert.AreEqual(10, ItemDB.AttributesOf("TestGem", 7, 0)["Attribute3: #"][0], "Level 7");
            Assert.AreEqual(15, ItemDB.AttributesOf("TestGem", 8, 0)["Attribute3: #"][0], "Level 8");
            Assert.AreEqual(15, ItemDB.AttributesOf("TestGem", 15, 0)["Attribute3: #"][0], "Level 15");
            // Attribute4: <Value Level="5">5</Value> <ValueForLevel From="1" To="7">10</ValueForLevel> <ValueForLevel From="8" To="9">15</ValueForLevel> <Value Level="10">10</Value>
            Assert.AreEqual(10, ItemDB.AttributesOf("TestGem", 1, 0)["Attribute4: #"][0], "Level 1");
            Assert.AreEqual(5, ItemDB.AttributesOf("TestGem", 5, 0)["Attribute4: #"][0], "Level 5");
            Assert.AreEqual(10, ItemDB.AttributesOf("TestGem", 7, 0)["Attribute4: #"][0], "Level 7");
            Assert.AreEqual(15, ItemDB.AttributesOf("TestGem", 8, 0)["Attribute4: #"][0], "Level 8");
            Assert.AreEqual(15, ItemDB.AttributesOf("TestGem", 9, 0)["Attribute4: #"][0], "Level 9");
            Assert.AreEqual(10, ItemDB.AttributesOf("TestGem", 10, 0)["Attribute4: #"][0], "Level 10");
            // Attribute5: <Value Level="1">1</Value> <Value Level="2">2</Value> <Value Level="3">3</Value>
            Assert.AreEqual(1, ItemDB.AttributesOf("TestGem", 1, 0)["Attribute5: #"][0], "Level 1");
            Assert.AreEqual(2, ItemDB.AttributesOf("TestGem", 2, 0)["Attribute5: #"][0], "Level 2");
            Assert.AreEqual(3, ItemDB.AttributesOf("TestGem", 3, 0)["Attribute5: #"][0], "Level 3");
            // Attribute6: <Value Level="1">1</Value> <Value Level="2">2</Value> ... <Value Level="30">30</Value>
            Assert.AreEqual(1, ItemDB.AttributesOf("TestGem", 1, 0)["Attribute6: #"][0], "Level 1");
            Assert.AreEqual(2, ItemDB.AttributesOf("TestGem", 2, 0)["Attribute6: #"][0], "Level 2");
            Assert.AreEqual(30, ItemDB.AttributesOf("TestGem", 30, 0)["Attribute6: #"][0], "Level 30");
            // Attribute7: <Value Level="1">1</Value> <Value Level="2">2</Value> ... <Value Level="30">30</Value>
            Assert.AreEqual(10, ItemDB.AttributesOf("TestGem", 1, 0)["Attribute7: #"][0], "Level 1");
            Assert.AreEqual(10, ItemDB.AttributesOf("TestGem", 2, 0)["Attribute7: #"][0], "Level 2");
            Assert.AreEqual(10, ItemDB.AttributesOf("TestGem", 30, 0)["Attribute7: #"][0], "Level 30");
            // Attribute8: <Value>10</Value>
            Assert.AreEqual(10, ItemDB.AttributesOf("TestGem", 1, 0)["Attribute8: #"][0], "Level 1");
            Assert.AreEqual(10, ItemDB.AttributesOf("TestGem", 30, 0)["Attribute8: #"][0], "Level 30");
        }
Esempio n. 6
0
        public void Set(string attribute, float value)
        {
            if (attributes.ContainsKey(attribute) == true)
            {
                attributes[attribute].floatValue = value;
            }
            else
            {
                ItemAttribute attrib = new ItemAttribute();

                attrib.attributeID = ItemDB.GetAttributeIDForName(attribute);
                attrib.floatValue  = value;

                attributes.Add(attribute, attrib);
            }
        }
Esempio n. 7
0
        public ItemListBox(ref Dictionary <int, ItemDB> DB)
        {
            foreach (KeyValuePair <int, ItemDB> items in DB)
            {
                ItemDB db = items.Value;
                Add(new ItemDB_Binding(db));
            }

            //if ( Count == 0)
            //{
            //    ItemDB db = new ItemDB();
            //    db.Id = 0;
            //    db.Name = "Null";
            //    Add(new ItemDB_Binding(db));
            //}
        }
 //http://localhost:51853/GroceryManagement/api/Item/1
 public IHttpActionResult Get(int id)
 {
     try
     {
         Item[] ia = ItemDB.GetItemByFamilyCode(id).ToArray();
         if (ia.Length == 0)
         {
             return(Content(HttpStatusCode.NotFound, $"Item of family {id} dont found!"));
         }
         return(Ok(ia));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.BadRequest, ex));
     }
 }
 //더블클릭용으로 사용하거나 장비하는 것을 자동으로 함
 public void AutoUseSelectedItem()
 {
     if (myItems.Count > myItemsSelected)
     {
         int    selectedItemCode = myItems[myItemsSelected].ItemCode;
         ItemDB itemInfo         = itemPool.pool[selectedItemCode];
         if (itemInfo.itemType == ItemType.Equipment)
         {
             EquipSelectedItem();
         }
         else if (itemInfo.itemType == ItemType.Potion)
         {
             UseSelectedItem();
         }
     }
 }
Esempio n. 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // displays a full list of all the items in the database

        // check if user is logged in
        if (Session["admin"] == null) // if user is not logged in, redirect to login page
        {
            Response.Redirect("Login.aspx");
            return;
        }

        List <Item> itemList = ItemDB.getAllItem();

        Repeater1.DataSource = itemList;
        Repeater1.DataBind();
    }
        public ActionResult Index()
        {
            List <ItemDB> tmp = new List <ItemDB>();
            PersonDB      stu = person.Persons.Find(User.Identity.Name);

            foreach (var r in request.Requests.ToList())
            {
                if (r.to == stu.item_now)
                {
                    PersonDB p = person.Persons.Find(r.from);
                    ItemDB   i = item.Items.Find(p.item_now);
                    tmp.Add(i);
                }
            }
            return(View(tmp));
        }
Esempio n. 12
0
        public ItemFactory(NodeContainer container)
        {
            this.Container = container;
            this.ItemDB    = new ItemDB(container.Database, this);

            // attribute manager goes first
            this.AttributeManager = new AttributeManager(this);
            // category manager goes first
            this.CategoryManager = new CategoryManager(this);
            // then groups
            this.GroupManager = new GroupManager(this);
            // then the type manager
            this.TypeManager = new TypeManager(this);
            // finally the item manager
            this.ItemManager = new ItemManager(this);
        }
Esempio n. 13
0
        public Entity CreateItem(string itemName, int typeID, int ownerID, int locationID, int flag, bool contraband, bool singleton, int quantity, double x, double y, double z, string customInfo)
        {
            ulong itemID = ItemDB.CreateItem(itemName, typeID, ownerID, locationID, flag, contraband, singleton, quantity, x, y, z, customInfo);

            if (itemID == 0)
            {
                return(null);
            }

            if (LoadItem((int)itemID) == false)
            {
                return(null);
            }

            return(itemList[itemID]);
        }
Esempio n. 14
0
        private async Task Update()
        {
            if (!LoadOld())
            {
                return;
            }
            foreach (var gem in ItemDB.GetAllGems())
            {
                var fetched = await _gemReader.FetchGemAsync(gem.Name);

                if (fetched != null)
                {
                    gem.Merge(fetched);
                }
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["itemID"] == null)
        {
            Response.Redirect("~/Categories.aspx");
        }
        else
        {
            List <Item> productDetails = new List <Item>();
            productDetails.Add(ItemDB.getItembyID(Request.QueryString["itemID"].ToString()));


            repeaterItemInformation.DataSource = productDetails;
            repeaterItemInformation.DataBind();
        }
    }
Esempio n. 16
0
    public UsedItemList(EQUIP.EquipItem user_item, ITEM_TYPE_ENUM itemtype, EQUIP_TYPE_ENUM equiptype)
    {
        switch (itemtype)
        {
        case ITEM_TYPE_ENUM.EQUIPMENT:
            Add(new EquipId()
            {
                Id        = user_item.EquipInfo.Id,
                Name      = user_item.EquipInfo.Name,
                Refine    = user_item.Refine,
                ImageRoot = user_item.EquipInfo.ImageName,
            });
            break;

        case ITEM_TYPE_ENUM.CARD:
            foreach (int card_id in user_item.Card)
            {
                ItemDB card = MainWindow._roo_db.Card_db[card_id];
                Add(new EquipId()
                {
                    Id        = card.Id,
                    Name      = card.Name,
                    ImageRoot = card.ImageName,
                });
            }
            break;

        case ITEM_TYPE_ENUM.ENCHANT:
            foreach (EQUIP.EquipItem.Enchant_param enchant_id in user_item.Enchant)
            {
                Add(new EquipId()
                {
                    Name        = Equip._enchant_db.Dic[enchant_id.Name].NAME_KOR,
                    Name_Eng    = enchant_id.Name,
                    EnchantName = Equip._enchant_db.Dic[enchant_id.Name].NAME_KOR + " " + Convert.ToString(enchant_id.Point),
                    Point       = enchant_id.Point
                });
            }
            break;

        case ITEM_TYPE_ENUM.GEAR:
            break;

        default:
            break;
        }
    }
        public SocketedGemsEditingViewModel(ItemImageService itemImageService, Item itemWithSockets)
        {
            _itemWithSockets = itemWithSockets;
            // convert ItemDB.Gems into GemBaseViewModels
            AvailableGems   = ItemDB.GetAllGems().Select(g => new GemBaseViewModel(itemImageService, g)).ToList();
            NumberOfSockets = _itemWithSockets.BaseType.MaximumNumberOfSockets;
            NewSocketedGem  = new SocketedGemViewModel
            {
                GemBase = AvailableGems[0],
                Level   = 1,
                Quality = 0,
                Group   = 1
            };
            AddGemCommand    = new RelayCommand(AddGem, CanAddGem);
            RemoveGemCommand = new RelayCommand <SocketedGemViewModel>(RemoveGem);

            SocketedGemsViewSource = new CollectionViewSource
            {
                Source = _socketedGems
            };
            SocketedGemsViewSource.SortDescriptions.Add(new SortDescription(
                                                            nameof(SocketedGemViewModel.GemBase) + "." + nameof(GemBaseViewModel.Name),
                                                            ListSortDirection.Ascending));
            SocketedGemsViewSource.SortDescriptions.Add(new SortDescription(
                                                            nameof(SocketedGemViewModel.Group),
                                                            ListSortDirection.Ascending));

            // convert currently socketed gem Items into SocketedGemViewModels
            foreach (var gem in _itemWithSockets.Gems)
            {
                var gemBase = AvailableGems.FirstOrDefault(g => g.Name == gem.Name);
                if (gemBase == null)
                {
                    continue;
                }
                var socketedGem = new SocketedGemViewModel
                {
                    GemBase = gemBase,
                    Level   = ItemDB.LevelOf(gem),
                    Quality = ItemDB.QualityOf(gem),
                    Group   = gem.SocketGroup + 1
                };
                socketedGem.PropertyChanged += SocketedGemsOnPropertyChanged;
                _socketedGems.Add(socketedGem);
            }
        }
Esempio n. 18
0
    protected void btnRent_Click(object sender, EventArgs e)
    {
        Item item = ItemDB.getItembyID(Request.QueryString["itemID"].ToString());

        // check if logged in
        if (Session["user"] == null) // user not logged in
        {
            Session["pageRedirectAfterLogin"] = Request.RawUrl;
            Response.Redirect("Login.aspx"); // transfer to login page
            return;
        }

        if (item.Renter.Email == Session["user"].ToString())
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Cannot rent your own item!')", true);

            return;
        }

        // insert rent record into database for item selected

        Session["itemExtension"] = "NotExtension";


        if (item.Renter.Email == Session["user"].ToString())
        {
            return;
        }


        if (itemStatus == "Available")
        {
            Session["itemStatus"] = "Available";
            Response.Redirect("~/itemRental.aspx?itemID=" + Request.QueryString["itemID"]);
        }
        else if (itemStatus == "On-going")
        {
            Session["itemStatus"] = "On-going";
            Response.Redirect("~/itemRental.aspx?itemID=" + Request.QueryString["itemID"]);
        }
        else
        {
            Session["itemStatus"] = "On-Going Extension";
            Response.Redirect("~/itemRental.aspx?itemID=" + Request.QueryString["itemID"]);
        }
    }
        private void LogNewItem(ItemDB newItem)
        {
            string path = AppDomain.CurrentDomain.BaseDirectory + @"\App_Data\NewItems.log";

            if (!File.Exists(path))
            {
                File.Create(path).Close();
            }
            StreamWriter logText = File.AppendText(path);

            logText.WriteLine(
                DateTime.UtcNow +
                "   ##### Name: " + newItem.Name +
                "   ##### Main category: " + newItem.BaseType.Name +
                "   ##### Class: " + newItem.Type.Name);
            logText.Close();
        }
Esempio n. 20
0
        public ActionResult Init(string item_name, string item_description)
        {
            ItemDB it = new ItemDB();

            it.name        = item_name;
            it.description = item_description;
            item.Items.Add(it);
            item.SaveChanges();

            PersonDB stu = person.Persons.Find(User.Identity.Name);

            stu.item_now      = it.id;
            stu.item_original = it.id;
            person.SaveChanges();

            return(RedirectToAction("Index"));
        }
Esempio n. 21
0
    int slotAmount;                                           //reference for the total amount of slots in the inventory


    void Start()
    {
        database       = GetComponent <ItemDB>();
        slotAmount     = 20;
        inventoryPanel = GameObject.Find("Inventory Panel");
        slotPanel      = GameObject.Find("Slot Panel");
        //Genrates the inventory slots
        for (int i = 0; i < slotAmount; i++)
        {
            items.Add(new Item());
            slots.Add(Instantiate(inventorySlot));
            slots[i].GetComponent <Slot>().id = i;
            slots[i].transform.SetParent(slotPanel.transform);
        }

        inventoryPanel.SetActive(false);
    }
Esempio n. 22
0
        public SwordmanJobBonus()
        {
            Bonus = new Dictionary <int, ItemDB>();
            for (int i = 5; i <= 40; i += 5)
            {
                Bonus[i] = new ItemDB();
            }

            Bonus[5].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.DEX)]  = 1;
            Bonus[5].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.VIT)]  = 1;
            Bonus[10].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.STR)] = 1;
            Bonus[10].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.VIT)] = 1;
            Bonus[15].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.STR)] = 1;
            Bonus[15].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.LUK)] = 1;
            Bonus[20].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.STR)] = 1;
            Bonus[20].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.AGI)] = 1;
            Bonus[25].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.STR)] = 1;
            Bonus[25].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.LUK)] = 1;
            Bonus[30].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.STR)] = 1;
            Bonus[30].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.AGI)] = 1;
            Bonus[35].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.STR)] = 1;
            Bonus[35].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.DEX)] = 2;
            Bonus[40].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.STR)] = 1;
            Bonus[40].Option_ITYPE[Enum.GetName(typeof(ITYPE), ITYPE.VIT)] = 1;

            //            크루
            //5   vit2 int1
            //10 int1 luk2
            //15 agi1 luk2
            //20 str2 agi1
            //25 str2 vit2
            //30 dex3 luk1
            //35 vit3 int2
            //40 str3 int2

            //팔라
            //5   str3 vit2
            //10 agi2 luk3
            //15 str2 dex3
            //20 agi2 vit4
            //25 int3 dex3
            //30 str4 agi2
            //35 int4 dex2
            //40 agi2 vit4
        }
Esempio n. 23
0
    protected void btnContactRenter_Click(object sender, EventArgs e)
    {
        // check if logged in
        if (Session["user"] == null) // user not logged in
        {
            Session["pageRedirectAfterLogin"] = Request.RawUrl;
            Response.Redirect("Login.aspx"); // transfer to login page
            return;
        }

        // allow Rentee to contact Renter
        Item item = ItemDB.getItembyID(Request.QueryString["itemID"].ToString());

        if (item.Renter.Email == Session["user"].ToString())
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Cannot message yourself!')", true);

            return;
        }
        // must be logged in to contact Renter
        if (Session["user"] == null)
        {
            Response.Redirect("Login.aspx");
            return;
        }
        else
        {
            // If memberInbox doesnt exist
            if (MemberInboxDB.searchMemberInbox(MemberDB.getMemberbyEmail(Session["user"].ToString()).MemberID, ItemDB.getItembyID(Request.QueryString["itemID"].ToString()).ItemID).MemberInboxID == -1)
            { // creates and send message
                MemberInbox mem = new MemberInbox();
                mem.Date   = DateTime.Now;
                mem.Item   = ItemDB.getItembyID(Request.QueryString["itemID"]);
                mem.Sender = MemberDB.getMemberbyEmail(Session["user"].ToString());

                int memberInboxID = MemberInboxDB.AddMsgMember(mem);
                Response.Redirect("/inboxMessage.aspx?memberInboxID=" + memberInboxID);
            }

            else
            {
                Response.Redirect("/inboxMessage.aspx?memberInboxID=" + MemberInboxDB.searchMemberInbox(MemberDB.getMemberbyEmail(Session["user"].ToString()).MemberID, ItemDB.getItembyID(Request.QueryString["itemID"].ToString()).ItemID).MemberInboxID);
            }
        }
    }
Esempio n. 24
0
        public AddonReader(ILogger logger, DataConfig dataConfig, AreaDB areaDb, IAddonDataProvider addonDataProvider)
        {
            this.logger            = logger;
            this.addonDataProvider = addonDataProvider;

            this.squareReader = new SquareReader(this);

            this.itemDb     = new ItemDB(logger, dataConfig);
            this.creatureDb = new CreatureDB(logger, dataConfig);

            this.BagReader       = new BagReader(squareReader, 20, itemDb);
            this.equipmentReader = new EquipmentReader(squareReader, 30);
            this.PlayerReader    = new PlayerReader(squareReader, creatureDb);
            this.LevelTracker    = new LevelTracker(PlayerReader);

            this.areaDb         = areaDb;
            this.worldMapAreaDb = new WorldMapAreaDB(logger, dataConfig);
        }
Esempio n. 25
0
        public static bool LoadUnloadedSolarSystems()
        {
            // Get all the solarSystems not loaded and load them
            List <int> solarSystems = GeneralDB.GetUnloadedSolarSystems();

            // Load the not-loaded solar systems
            foreach (int solarSystemID in solarSystems)
            {
                // We can assume we dont have it in the list, as we've queryed for the non-loaded solarSystems
                SolarSystem solarSystem = new SolarSystem(ItemDB.LoadItem(solarSystemID), ItemDB.GetSolarSystemInfo(solarSystemID)); // Create the solarSystem class

                if (LoadSolarSystem(solarSystem) == false)
                {
                    return(false);
                }
            }
            return(true);
        }
    private void Load(string filePath)
    {
        idb = ScriptableObject.CreateInstance <ItemDB>();
        int    lastSlash = filePath.LastIndexOf('/');
        string fileName  = filePath.Substring(lastSlash + 1, filePath.Length - ".asset".Length - lastSlash - 1);

        UnityEngine.Object file = Resources.Load <ItemDB>(fileName);
        if (file != null)
        {
            idb = (ItemDB)file;
        }
        else
        {
            Debug.LogWarning("File not found - will create new one.");
        }

        folded = new List <bool>();
    }
        public async Task <ActionResult> SubmitBooking(BookingFormModel formModel)
        {
            var lab_id  = int.Parse(TempData["LabID"].ToString());
            var user_id = int.Parse(HttpContext.Request.Cookies["userID"]);

            var time_id = formModel.time_am + formModel.time_pm;

            var items = await ItemDB.GetAvailableItems(formModel.book_date);

            items.RemoveAll(item => item.type != formModel.item_type);

            switch (time_id)
            {
            case 1:
                items.RemoveAll(item => item.time_am == false);
                break;

            case 2:
                items.RemoveAll(item => item.time_pm == false);
                break;

            case 3:
                items.RemoveAll(item => item.time_am == false || item.time_pm == false);
                break;

            default:
                break;
            }

            if (items.Count > 0)
            {
                for (var i = 0; i < formModel.quantity; ++i)
                {
                    var temp = TransactionDB.Add(new Transaction(user_id, items[i].uuid, (int)Transaction_type.borrow, time_id, formModel.book_date)).Result;
                    if (temp == 1)
                    {
                        TempData["BookingSucceed"] = false;
                        return(RedirectToAction("Booking", new { labID = lab_id }));
                    }
                }
            }

            return(RedirectToAction("Index", "User"));
        }
Esempio n. 28
0
    public void BuildingAdded(Building building)
    {
        //Is the building a constructor?
        if (building.ID == 0 || building.ID == 2)
        {
            m_GUIManager.AddConstructor(building);
        }

        if (m_Buildings.Count == 0 || m_Buildings.FirstOrDefault(x => x.ID == building.ID) == null)
        {
            //This is a new building, need to update available items
            m_AvailableItems.AddRange(ItemDB.GetAvailableItems(building.ID, m_Buildings));

            //Tell all the contents to update themselves
            m_GUIManager.UpdateQueueContents(m_AvailableItems);
        }

        m_Buildings.Add(building);
    }
Esempio n. 29
0
    public int AddItem(ItemDB objDB, SqlTransaction objTrans)
    {
        DataAccessLayer objDataLayer = new DataAccessLayer();
        SqlCommand objCmd = new SqlCommand();
        int Status = 0;
        try
        {
            if (objDB.StatusID == 0)
            {
                objCmd.CommandText = "usp_AddItem";
            }
            else
            {
                objCmd.CommandText = "usp_UpdateItem";
            }
            objCmd.CommandType = CommandType.StoredProcedure;
            objCmd.Parameters.AddWithValue("@Code", objDB.ItemCode);
            objCmd.Parameters.AddWithValue("@GroupID", objDB.GroupID);
            objCmd.Parameters.AddWithValue("@Description", objDB.Description);
            objCmd.Parameters.AddWithValue("@IsActive", objDB.IsActive);
            objCmd.Parameters.AddWithValue("@InReport", objDB.InReport);
            objCmd.Parameters.AddWithValue("@IsGroup", objDB.IsGroup);
            objCmd.Parameters.AddWithValue("@EffectDate", objDB.EffectDate);

            objCmd.Transaction = objTrans;
            objCmd.Connection = objTrans.Connection;
            objDataLayer.Command = objCmd;
            objDataLayer.ExecQuery();
        }
        catch (Exception ex)
        {

            throw ex;
        }
        return Status;
    }
Esempio n. 30
0
    public int SaveItem(ItemDB objDB, SqlTransaction objTrans)
    {
        DataAccessLayer objDataLayer = new DataAccessLayer();
        SqlCommand objCmd = new SqlCommand();
        int Status = 0;
        try
        {
            objCmd.CommandText = "usp_UpdateItemException";
            objCmd.CommandType = CommandType.StoredProcedure;
            objCmd.Parameters.AddWithValue("@ItemCode",objDB.ItemCode);
            objCmd.Parameters.AddWithValue("@ItemGroupName", objDB.ItemGroupName);
            objCmd.Parameters.AddWithValue("@GroupID", objDB.GroupID);
            objCmd.Transaction = objTrans;
            objCmd.Connection = objTrans.Connection;
            objDataLayer.Command = objCmd;
            objDataLayer.ExecQuery();
        }
        catch (Exception ex)
        {

            throw ex;
        }
        return Status;
    }
 void Start()
 {
     _itemDB = GameObject.FindGameObjectWithTag(TagList.Inventory).GetComponent<ItemDB>();
     _inventory = GameObject.FindGameObjectWithTag(TagList.Inventory).GetComponent<Inventory>();
 }
Esempio n. 32
0
 // Use this for initialization
 void Start()
 {
     Screen.sleepTimeout = SleepTimeout.NeverSleep;
     Init.Seta_esq.GetComponent<Image>().enabled = false;
     GameObject.Find("Scrollbar").GetComponent<Scrollbar>().value = 1;
     GameObject.Find("Caixa").transform.position = new Vector3(GameObject.Find("Caixa").transform.position.x, GameObject.Find("Caixa").transform.position.y, -6400);
     invent = GetComponent<ItemDB>();
     bluron = false;
 }
Esempio n. 33
0
    void Start()
    {
        database = GetComponent<ItemDB>();
        clicavel = GetComponent<ItemUso>();
        inventario = GameObject.Find("Inventario");
        Painel = inventario.transform.FindChild("Painel").gameObject;

        for (int i = 0; i < slotlimit; i++)
        {
            items.Add(new ItemDB.Item());
            slots.Add(Instantiate(Slot));
            slots[i].transform.SetParent(Painel.transform);
            slots[i].transform.localScale = Prop;
            Vector3 temp = slots[i].transform.position;
            temp.z = 12;
            slots[i].transform.position = temp;
        }
    }
Esempio n. 34
0
    /// <summary>
    /// Init functions. Creates database (where it lies)
    /// Init empty items
    /// </summary>
    void Awake () {
	    itemDB = new ItemDB();        
	}
    void OnGUI()
    {
        if (db == null) db = new ItemDB();

        Item item;
        Rect iconPos;

        GUILayout.Label("New Item");
        GUILayout.BeginHorizontal ();
        if (GUILayout.Button("Create New")) db.CreateItem();
        GUILayout.EndHorizontal ();

        GUILayout.Label("// TODO: Add Sort and Filter options.");

        GUILayout.Label("Items", EditorStyles.boldLabel);

        scrollOffset = GUILayout.BeginScrollView(scrollOffset);
        for (int i = 0, len = db.size; i < len; i++)
        {
            item = db.items[i];

            /*
             * Begin GUILayout formatting
             */
            EditorGUILayout.BeginHorizontal(GUILayout.Height(48f));

                EditorGUILayout.BeginVertical();
                    if (i != 0)
                    {
                        if (GUILayout.Button("X", GUILayout.Width(18f)))
                        {
                            if(EditorUtility.DisplayDialog("Are you sure?", "You are about to delete item number " + item.itemId.ToString() + " (" + item.itemName + ").\nAre you sure?", "Delete", "Cancel"))
                            {
                                db.DeleteItem(item.itemId);
                            }
                        }
                    }
                    else
                    {
                        GUILayout.Button("X", GUILayout.Width(18f));
                    }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical();

                    EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.LabelField(item.itemId.ToString(), GUILayout.Width(24f));
                        item.itemName = EditorGUILayout.TextField(item.itemName);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                        item.itemType = (ItemType)EditorGUILayout.EnumPopup(item.itemType, GUILayout.Width(60f));
                        if (item.itemType == ItemType.StdEquip) item.eqSlot = (Equipment)EditorGUILayout.EnumPopup(item.eqSlot, GUILayout.Width(60f));
                        item.itemIcon = (Sprite)EditorGUILayout.ObjectField(item.itemIcon, typeof(Sprite), true);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                        item.description = EditorGUILayout.TextArea(item.description, GUILayout.Height(30f));
                    EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(GUILayout.Width(48f));

                    iconPos = EditorGUILayout.BeginHorizontal(GUILayout.Height(48f));
                        iconPos.width = 48f;
                        iconPos.height = 48f;
                        if (item.itemIcon != null)
                            EditorGUI.DrawPreviewTexture(iconPos, item.itemIcon.texture, new Material(Shader.Find("UI/Default")));
                        else
                            EditorGUI.DrawRect(iconPos, Color.grey);
                    EditorGUILayout.EndHorizontal();

                EditorGUILayout.EndVertical();

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(12f);
            /*
             * End GUILayout formatting
             */
        }
        GUILayout.EndScrollView();
    }