Пример #1
0
        public ReturnType RemoveItemProp(string cid)
        {
            try
            {
                using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
                {
                    /*List<ItemProp> list = alading.ItemProp.Where(p => p.ItemPropID == itempropID).ToList();*/
                    List <ItemProp> list = alading.ItemProp.Where(p => p.cid == cid).ToList();
                    if (list.Count == 0)
                    {
                        return(ReturnType.NotExisted);
                    }

                    else
                    {
                        ItemProp sy = list.First();
                        alading.DeleteObject(sy);
                        alading.SaveChanges();
                        return(ReturnType.Success);
                    }
                }
            }
            catch (SqlException sex)
            {
                return(ReturnType.ConnFailed);
            }
            catch (System.Exception ex)
            {
                return(ReturnType.OthersError);
            }
        }
Пример #2
0
    public void minusitem(int id, int number)
    {
        Item itemtominus = database.FetchItem(id);

        if (CheckEqualtem(itemtominus))
        {
            for (int i = 0; i < storageslots.Count; i++)
            {
                if (storageitems[i] != null)
                {
                    ItemProp data = storageitems[i].GetComponent <ItemProp>();
                    if (data.myitem.item_id == id)
                    {
                        data.the_number -= number;
                        if (data.the_number <= 0)
                        {
                            Destroy(data.gameObject);
                            storageitems.RemoveAt(i);
                            storageitems.Insert(i, null);

                            /*if (checkItemRemove(itemtominus))
                             * {
                             *  removeitem(itemtominus);
                             * }*/
                        }
                        else
                        {
                            data.GetComponentInChildren <Text>().text = data.the_number.ToString();
                        }
                        break;
                    }
                }
            }
        }
    }
Пример #3
0
        void FillItemProperty(ItemProp itProp, Expander parentcontainer)
        {
            StackPanel container = new StackPanel();

            container.Orientation = Orientation.Vertical;
            container.Margin      = new Thickness(40, 0, 0, 0);

            itProp.childs.ForEach(v => {
                if (v.hasChilds)
                {
                    Expander itemExpander   = new Expander();
                    itemExpander.IsExpanded = IsStartExpanded;
                    itemExpander.Header     = GetDetailView(v.name, v.value);
                    itemExpander.Style      = (Style)FindResource("expander");

                    FillItemProperty(v, itemExpander);
                    container.Children.Add(itemExpander);
                }
                else
                {
                    container.Children.Add(GetDetailView(v.name, v.value));
                }
                parentcontainer.Content = container;
            });
        }
Пример #4
0
 public ReturnType AddItemProp(ItemProp itemprop)
 {
     try
     {
         using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
         {
             Alading.Entity.ItemProp DBitemprop = alading.ItemProp.Where(p => p.cid == itemprop.cid && p.pid == itemprop.pid).FirstOrDefault();
             if (DBitemprop == null)
             {
                 alading.AddToItemProp(itemprop);
                 if (alading.SaveChanges() == 1)
                 {
                     return(ReturnType.Success);
                 }
                 else
                 {
                     return(ReturnType.SaveFailed);
                 }
             }
             else
             {
                 return(ReturnType.PropertyExisted);
             }
         }
     }
     catch (SqlException sex)
     {
         return(ReturnType.ConnFailed);
     }
     catch (Exception ex)
     {
         return(ReturnType.OthersError);
     }
 }
Пример #5
0
    public void OnDrop(PointerEventData eventData)
    {
        ItemProp droppeditem = eventData.pointerDrag.GetComponent <ItemProp>(); //drop하는 아이템

        //Transform item = transform.GetChild(0); //슬롯 안에 있는 아이템
        if (slot_location == ItemLocation.Inventory)                                    // inventory일때만
        {                                                                               // invenslot -> invenslot,   storageslot -> invenslot
            Debug.Log("slot_location.inventory");
            if (droppeditem.mylocation == ItemLocation.Inventory)                       // invenslot -> invenslot
            {
                if (AccInven.items[slot_id] == null)                                    // 비어있는 slot이면       //inven만 적용됨
                {                                                                       // droppeditem을 비어있는곳에 넣고 원래자리를 비어줌
                    AccInven.items[slot_id] = eventData.pointerDrag;
                    droppeditem.transform.SetParent(AccInven.slots[slot_id].transform); //setparent
                    droppeditem.transform.localPosition = Vector2.zero;

                    AccInven.items[droppeditem.slotAddress] = null; //items[i]
                    droppeditem.slotAddress = slot_id;              //slotaddress
                }
                else // 비어있는게 아닐때  swap해줌
                {
                    GameObject originitem   = AccInven.items[slot_id];
                    GameObject dropitem     = eventData.pointerDrag;
                    int        originslotid = slot_id;
                    int        dropslotid   = droppeditem.slotAddress;

                    AccInven.items[originslotid].transform.SetParent(AccInven.slots[dropslotid].transform); //set parent
                    AccInven.items[originslotid].GetComponent <ItemProp>().slotAddress = dropslotid;        //slotaddress
                    AccInven.items[originslotid].transform.localPosition = Vector2.zero;
                    eventData.pointerDrag.transform.SetParent(AccInven.slots[originslotid].transform);
                    dropitem.GetComponent <ItemProp>().slotAddress = originslotid;
                    AccInven.items[dropslotid]          = AccInven.items[originslotid]; //items[i]
                    AccInven.items[originslotid]        = dropitem;
                    droppeditem.transform.localPosition = Vector2.zero;
                }
            }
            else//storage -> invenslot ,  itemlocation을 바꿔줘야됨
            {
                if (AccInven.items[slot_id] == null) // 비어있는 slot이면
                {                                                                       // droppeditem을 비어있는곳에 넣고 원래자리를 비어줌
                    AccInven.items[slot_id] = eventData.pointerDrag;
                    droppeditem.transform.SetParent(AccInven.slots[slot_id].transform); //setparent
                    droppeditem.transform.localPosition = Vector2.zero;
                    droppeditem.mylocation = ItemLocation.Inventory;
                    AccInven.items[droppeditem.slotAddress] = null; //items[i]
                    droppeditem.slotAddress = slot_id;              //slotaddress
                }
                else // 비어있는게 아닐때
                {
                    //storage ->inventory는 안됨
                }
            }
        }
        else if (slot_location == ItemLocation.Storage)  //else  storage일때 자리바꾸기 안되게 설정
        {
        }
    }
Пример #6
0
        public ReturnType UpdateItemProp(string itempropCode, ItemProp itemprop)
        {
            throw new NotImplementedException();
            //try
            //{
            //    using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
            //    {
            //        /*var result = alading.ItemProp.Where(p => p.ItemPropID == itempropID).ToList();*/
            //        var result = alading.ItemProp.Where(p => p.ItemPropCode == itempropCode).ToList();
            //        if (result.Count == 0)
            //        {
            //            return ReturnType.NotExisted;
            //        }

            //        ItemProp ob = result.First();
            //        ob.cid = itemprop.cid;
            //        ob.pid = itemprop.pid;
            //        ob.parent_pid = itemprop.parent_pid;
            //        ob.parent_vid = itemprop.parent_vid;
            //        ob.name = itemprop.name;
            //        ob.is_key_prop = itemprop.is_key_prop;
            //        ob.is_sale_prop = itemprop.is_sale_prop;
            //        ob.is_color_prop = itemprop.is_color_prop;
            //        ob.is_enum_prop = itemprop.is_enum_prop;
            //        ob.is_input_prop = itemprop.is_input_prop;
            //        ob.is_item_prop = itemprop.is_item_prop;
            //        ob.must = itemprop.must;
            //        ob.multi = itemprop.multi;
            //        ob.prop_values = itemprop.prop_values;
            //        ob.child_template = itemprop.child_template;
            //        ob.status = itemprop.status;
            //        ob.sort_order = itemprop.sort_order;
            //        ob.is_allow_alias = itemprop.is_allow_alias;

            //        if (alading.SaveChanges() == 1)
            //        {
            //            return ReturnType.Success;
            //        }
            //        else
            //        {
            //            return ReturnType.OthersError;
            //        }
            //    }
            //}
            //catch (SqlException sex)
            //{
            //    return ReturnType.ConnFailed;
            //}
            //catch (System.Exception ex)
            //{
            //    return ReturnType.OthersError;
            //}
        }
Пример #7
0
        public ItemProp GetProperties(int ItemID)
        {
            PropertyInfo p     = Property(ItemID);
            ItemProp     pdict = new ItemProp();

            string[] plist = p.Info.Split('\n');
            foreach (string s in plist)
            {
                string temp = s.Replace("%", "").Replace(":", "");
                pdict.Name  = temp.Substring(0, temp.LastIndexOf(' '));
                pdict.Value = temp.Substring(temp.LastIndexOf(' '));
            }
            return(pdict);
        }
Пример #8
0
 public ItemProp GetItemProp(string cid, string pid)
 {
     try
     {
         using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
         {
             ItemProp itemProp = alading.ItemProp.FirstOrDefault(i => i.cid == cid && i.pid == pid);
             return(itemProp);
         }
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
Пример #9
0
 public ItemProp(ItemProp obj)
 {
     name = obj.name;
     id = obj.id;
     health = obj.health;
     rDrag = obj.rDrag;
     rAngularDrag = obj.rAngularDrag;
     pack = obj.pack;
     userful = obj.userful;
     eat = obj.eat;
     plant = obj.plant;
     suit = obj.suit;
     recovery = obj.recovery;
     spares = obj.spares;
     active = obj.active;
     listable = obj.listable;
     iznosable = obj.iznosable;
 }
Пример #10
0
 public static Item ToItem(ItemInfo item)
 {
     var obj = new Item();
     obj.item_id = item.Item_Id;
     obj.item_category_id = item.Item_Category_Id;
     obj.item_code = item.Item_Code;
     obj.item_name = item.Item_Name;
     obj.item_name_en = item.Item_Name_En;
     obj.item_name_short = item.Item_Name_Short;
     obj.item_status = item.Status;
     obj.item_remark = item.Item_Remark;
     obj.pyzjm = item.Pyzjm;
     obj.create_user_id = item.Create_User_Id;
     obj.create_time = item.Create_Time;
     obj.modify_user_id = item.Modify_User_Id;
     obj.modify_time = item.Modify_Time;
     obj.if_gifts = Utils.GetStrVal(item.ifgifts);
     obj.if_often = Utils.GetStrVal(item.ifoften);
     obj.if_service = Utils.GetStrVal(item.ifservice);
     obj.isgb = Utils.GetStrVal(item.isGB);
     obj.data_from = Utils.GetStrVal(item.data_from);
     obj.display_index = Utils.GetStrVal(item.display_index);
     obj.item_props = new List<ItemProp>();
     if (item.ItemPropList != null)
     {
         foreach (var itemProp in item.ItemPropList)
         {
             var objProp = new ItemProp();
             objProp.item_id = itemProp.Item_Id;
             objProp.item_property_id = itemProp.Item_Property_Id;
             objProp.property_code_group_id = itemProp.PropertyCodeGroupId;
             objProp.property_code_id = itemProp.PropertyCodeId;
             objProp.property_detail_id = itemProp.PropertyDetailId;
             objProp.property_code_value = itemProp.PropertyCodeValue;
             objProp.status = Utils.GetStrVal(itemProp.Status);
             objProp.property_code_group_name = itemProp.PropertyCodeGroupName;
             objProp.property_code_name = itemProp.PropertyCodeName;
             objProp.create_user_id = itemProp.Create_User_id;
             objProp.create_time = itemProp.Create_Time;
             obj.item_props.Add(objProp);
         }
     }
     return obj;
 }
    void ChangeItem()
    {
        if (Toolbar.Instance.SelectedSlot.ReferencedItemStack != null)
        {
            ItemBase selectedItem = Toolbar.Instance.SelectedSlot.ReferencedItemStack.ContainedItem;

            if (selectedItem as ItemProp == null)
            {
                CurrentItem = null;
            }
            else
            {
                print("ID: " + selectedItem.ID);
                CurrentItem = ItemSystem.Instance.GetItemClone(selectedItem.ID) as ItemProp;
            }
        }

        else
        {
            CurrentItem = null;
        }

        if (CurrentItem != null)
        {
            ReferencedObject = CurrentItem.Props[0];
            ObjectIndex      = 0;
            Cursor.gameObject.SetActive(true);
            Cursor.Set(CurrentItem);
        }
        else
        {
            ReferencedObject = null;
            if (Cursor != null)
            {
                Cursor.gameObject.SetActive(false);
            }
        }


        if (OnSelectedItemChanged != null)
        {
            OnSelectedItemChanged();
        }
    }
Пример #12
0
    void Update()
    {
        RaycastHit hit;
        Vector3    fwd = playerVitals.gameObject.transform.TransformDirection(Vector3.forward);

        if (Physics.Raycast(playerVitals.gameObject.transform.position, fwd, out hit, rayLength, newLayerMask.value))
        {
            if (hit.collider.CompareTag("Collect"))
            {
                PickText.text = "Left Click To Pick";
                RaycastedObj  = hit.collider.gameObject;
                if (Input.GetMouseButtonDown(0))
                {
                    ItemProp ThisItem = RaycastedObj.GetComponent <ItemProp>();
                    ThisItem.Interact();
                    // Do Something
                }
            }
        }
        else
        {
            PickText.text = "";
        }
    }
		void FillItemProperty(ItemProp itProp, Expander parentcontainer) {
			StackPanel container = new StackPanel();
			container.Orientation = Orientation.Vertical;
			container.Margin = new Thickness(40, 0, 0, 0);

			itProp.childs.ForEach(v => {
				if (v.hasChilds) {
					Expander itemExpander = new Expander();
					itemExpander.IsExpanded = IsStartExpanded;
					itemExpander.Header = GetDetailView(v.name, v.value);
					itemExpander.Style = (Style)FindResource("expander");

					FillItemProperty(v, itemExpander);
					container.Children.Add(itemExpander);
				} else {
					container.Children.Add(GetDetailView(v.name, v.value));
				}
				parentcontainer.Content = container;
			});
		}
Пример #14
0
    public void Additem(int id, int number)
    {
        Item itemtoadd = database.FetchItem(id);

        if (CheckEqualtem(itemtoadd) && itemtoadd.IsStackable) //같은아이템 있고 그아이템이 스택쌓을수있으면
        {                                                      // 숫자만 늘려주면됨
            for (int i = 0; i < storageslots.Count; i++)       // 다시 같은아이템 찾아줌
            {
                if (storageitems[i] != null)
                {
                    ItemProp data = storageitems[i].GetComponent <ItemProp>();
                    if (data.myitem.item_id == id)                                              //같은 아이템 찾으면
                    {
                        data.the_number += number;                                              //+1하고
                        data.GetComponentInChildren <Text>().text = data.the_number.ToString(); //text 업데이트
                        break;
                    }
                }
            }
        }
        else if (!itemtoadd.IsStackable) //스택쌓을수없는경우
        {
            for (int i = 0; i < slotamount; i++)
            {
                if (storageitems[i] == null)
                {
                    GameObject itemobj = Instantiate(storageitem);
                    ItemProp   prop    = itemobj.GetComponent <ItemProp>();
                    itemobj.transform.SetParent(storageslots[i].transform);
                    prop.myitem     = itemtoadd;
                    prop.the_number = 1;                                          //무조곤 한개임
                    itemobj.GetComponentInChildren <Text>().text = "";
                    prop.mylocation                       = ItemLocation.Storage; //storage
                    prop.slotAddress                      = i;                    //뺴도될듯
                    itemobj.transform.position            = Vector2.zero;
                    itemobj.transform.localPosition       = Vector2.zero;
                    itemobj.GetComponent <Image>().sprite = itemtoadd.item_icon;
                    storageitems[i]                       = itemobj;
                    break;
                }
            }
        }
        else
        {
            for (int i = 0; i < slotamount; i++)
            {
                if (storageitems[i] == null)
                {
                    GameObject itemobj = Instantiate(storageitem);
                    ItemProp   prop    = itemobj.GetComponent <ItemProp>();
                    itemobj.transform.SetParent(storageslots[i].transform);
                    prop.myitem      = itemtoadd;
                    prop.the_number  = number;
                    prop.mylocation  = ItemLocation.Storage; // 위치느 storage
                    prop.slotAddress = i;                    //뺴도될듯
                    if (prop.the_number > 1)
                    {
                        itemobj.GetComponentInChildren <Text>().text = prop.the_number.ToString();
                    }
                    itemobj.transform.position            = Vector2.zero;
                    itemobj.transform.localPosition       = Vector2.zero;
                    itemobj.GetComponent <Image>().sprite = itemtoadd.item_icon;

                    storageitems[i] = itemobj;
                    break;
                }
            }
        }
    }
Пример #15
0
        public ReturnType UpdateItemProp(ItemProp itemprop)
        {
            throw new NotImplementedException();
            //try
            //{
            //    using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
            //    {
            //        /*ItemProp result = alading.ItemProp.Where(p => p.ItemPropID == itemprop.ItemPropID).FirstOrDefault();*/
            //        ItemProp result = alading.ItemProp.Where(p => p.ItemPropCode == itemprop.ItemPropCode).FirstOrDefault();
            //        if (result == null)
            //        {
            //            return ReturnType.NotExisted;
            //        }
            //        #region   Using Attach() Function Update,Default USE;
            //        alading.Attach(result);
            //        alading.ApplyPropertyChanges("ItemProp", itemprop);
            //        #endregion

            //        #region    Using All Items Replace To Update ,Default UnUse
            //        /*

            //            result.cid = itemprop.cid;

            //            result.pid = itemprop.pid;

            //            result.parent_pid = itemprop.parent_pid;

            //            result.parent_vid = itemprop.parent_vid;

            //            result.name = itemprop.name;

            //            result.is_key_prop = itemprop.is_key_prop;

            //            result.is_sale_prop = itemprop.is_sale_prop;

            //            result.is_color_prop = itemprop.is_color_prop;

            //            result.is_enum_prop = itemprop.is_enum_prop;

            //            result.is_input_prop = itemprop.is_input_prop;

            //            result.is_item_prop = itemprop.is_item_prop;

            //            result.must = itemprop.must;

            //            result.multi = itemprop.multi;

            //            result.prop_values = itemprop.prop_values;

            //            result.child_template = itemprop.child_template;

            //            result.status = itemprop.status;

            //            result.sort_order = itemprop.sort_order;

            //            result.is_allow_alias = itemprop.is_allow_alias;

            //        */
            //        #endregion
            //        if (alading.SaveChanges() == 1)
            //        {
            //            return ReturnType.Success;
            //        }
            //    }
            //}
            //catch (SqlException sex)
            //{
            //    return ReturnType.ConnFailed;
            //}
            //catch (Exception ex)
            //{
            //    return ReturnType.OthersError;
            //}
        }
Пример #16
0
    public void Itemshow(ItemProp itemgo)
    {
        Item item = itemgo.myitem;

        descriptiontxt.text = item.Description;
    }
Пример #17
0
 public void CallInputPanel(Vector2 pos, ItemProp itemp)
 {
     transform.position = pos;
     itemprop           = itemp;
     maxamount          = itemprop.the_number;
 }
Пример #18
0
 public void Set(ItemProp pItem)
 {
     Item          = pItem;
     Sprite.sprite = pItem.Props[PlaceObjectManager.Instance.ObjectIndex].GetComponent <SpriteRenderer>().sprite;
 }
			public ItemProp(string name, string value, ItemProp[] childs) {
				this.name = name;
				this.value = value;
				this.childs = childs;
			}
Пример #20
0
 public void Calltooltip(ItemProp item)
 {
     Itemshow(item);
     transform.position = pos;
 }
Пример #21
0
 public static ReturnType AddItemProp(ItemProp itemprop)
 {
     return(DataProviderClass.Instance().AddItemProp(itemprop));
 }
Пример #22
0
 public Item(string _name, float _health, bool _pack)
 {
     Ip = new ItemProp(_name, _health, _pack);
 }
Пример #23
0
 public static ReturnType UpdateItemProp(string itempropCode, ItemProp itemprop)
 {
     return(DataProviderClass.Instance().UpdateItemProp(itempropCode, itemprop));
 }
			public Item(string name, ItemProp[] details, ItemFlags flags = ItemFlags.AllOperationsAvailable) {
				this.name = name;
				this.details = details;
				this.flags = flags;
			}