示例#1
0
        void ShowExplainTextItem(ITEM_ID itemId)
        {
            string itemName = ItemManager.instance.GetNameByItemId(itemId);
            string explain  = string.Format(LocalizationManager.instance.GetLocalString(GAME_STRING.FOUND_ITEM), itemName);

            Notice.instance.Show(explain, 2f, Color.white);
        }
示例#2
0
 public bool AddItemInBag(ITEM_ID itemId)
 {
     if (bag.Count == bagSize)
     {
         return(false);
     }
     bag.Add(itemId);
     return(true);
 }
示例#3
0
        public string GetNameByItemId(ITEM_ID id)
        {
            if (itemList.ContainsKey(id))
            {
                return(itemList[id].name);
            }

            print("Error: id doesnot exist8");
            return("");
        }
示例#4
0
        public Item GetItemByItemId(ITEM_ID id)
        {
            if (itemList.ContainsKey(id))
            {
                return(itemList[id]);
            }

            print("Error: id doesnot exist8");
            return(null);
        }
示例#5
0
        public int GetPriceByItemId(ITEM_ID id)
        {
            if (itemList.ContainsKey(id))
            {
                return(itemList[id].price);
            }

            print("Error: id doesnot exist8");
            return(-1);
        }
示例#6
0
 private void btnAddItem_Click(object sender, EventArgs e)
 {
     clsUtility.ExecuteSQLQuery(" SELECT  * FROM   Users  WHERE   USER_ID = '" + clsUtility.UserID + "' AND   Can_Add = 'Y' ");
     if (clsUtility.sqlDT.Rows.Count > 0)
     {
         ///////////////////////////////////////////
         if (rbItem.Checked)
         {
             if (cmbItemName.SelectedValue == null | cmbItemName.SelectedIndex == -1 | string.IsNullOrWhiteSpace(this.txtQty.Text))
             {
                 errorProvider.SetError(cmbItemName, "Required"); errorProvider.SetError(txtQty, "Required");
             }
             else
             {
                 InsertSalesItem(cmbItemName.SelectedValue.ToString(), Convert.ToDouble(txtQty.Text));
                 errorProvider.Clear();
                 LoadSalesItem();
                 txtQty.Text = "";
             }
         }
         else
         {
             if (string.IsNullOrWhiteSpace(txtBarcode.Text) | string.IsNullOrWhiteSpace(this.txtQty.Text))
             {
                 errorProvider.SetError(txtBarcode, "Required"); errorProvider.SetError(txtQty, "Required");
             }
             else
             {
                 double ITEM_ID;
                 clsUtility.ExecuteSQLQuery("SELECT * FROM ItemInformation WHERE  Barcode = '" + txtBarcode.Text + "'");
                 if (clsUtility.sqlDT.Rows.Count > 0)
                 {
                     ITEM_ID = Convert.ToDouble(clsUtility.sqlDT.Rows[0]["ITEM_ID"]);
                     InsertSalesItem(ITEM_ID.ToString(), Convert.ToDouble(txtQty.Text));
                     errorProvider.Clear();
                     LoadSalesItem();
                     txtQty.Text     = "";
                     txtBarcode.Text = "";
                 }
                 else
                 {
                     clsUtility.MesgBoxShow("msgNotFound", "info");
                 }
             }
         }
         ///////////////////////////////////////////
     }
     else
     {
         clsUtility.MesgBoxShow("msgPermission", "err");
     }
 }
示例#7
0
        public Vector3[] GetDestroyRange(Vector3 targetPos, ITEM_ID itemId)
        {
            switch (itemId)
            {
            case ITEM_ID.DESTROY_4D:
                return(new Vector3[]
                {
                    new Vector3(targetPos.x + 1, targetPos.y, 0),
                    new Vector3(targetPos.x - 1, targetPos.y, 0),
                    new Vector3(targetPos.x, targetPos.y + 1, 0),
                    new Vector3(targetPos.x, targetPos.y - 1, 0)
                });

            case ITEM_ID.DESTROY_LR:
                return(new Vector3[]
                {
                    new Vector3(targetPos.x + 1, targetPos.y, 0),
                    new Vector3(targetPos.x + 2, targetPos.y, 0),
                    new Vector3(targetPos.x - 1, targetPos.y, 0),
                    new Vector3(targetPos.x - 2, targetPos.y, 0)
                });

            case ITEM_ID.DESTROY_UD:
                return(new Vector3[]
                {
                    new Vector3(targetPos.x, targetPos.y - 1, 0),
                    new Vector3(targetPos.x, targetPos.y - 2, 0),
                    new Vector3(targetPos.x, targetPos.y + 1, 0),
                    new Vector3(targetPos.x, targetPos.y + 2, 0)
                });

            //case 3:
            //    return new Vector3[]
            //    {
            //        new Vector3(targetPos.x+1, targetPos.y+1, 0  ),
            //        new Vector3(targetPos.x+1, targetPos.y-1, 0  ),
            //        new Vector3(targetPos.x-1, targetPos.y+1, 0  ),
            //        new Vector3(targetPos.x-1, targetPos.y-1, 0  )
            //    };

            default:
                return(new Vector3[]
                {
                    new Vector3(targetPos.x, targetPos.y, 0),
                    new Vector3(targetPos.x, targetPos.y, 0),
                    new Vector3(targetPos.x, targetPos.y, 0),
                    new Vector3(targetPos.x, targetPos.y, 0)
                });
            }
        }
示例#8
0
 private void txtBarcode_KeyPress(object sender, KeyPressEventArgs e)
 {
     clsUtility.ExecuteSQLQuery(" SELECT  * FROM   Users  WHERE   USER_ID = '" + clsUtility.UserID + "' AND   Can_Add = 'Y' ");
     if (clsUtility.sqlDT.Rows.Count > 0)
     {
         ///////////////////////////////////////////
         if (e.KeyChar == Convert.ToChar(Keys.Return))
         {
             if (string.IsNullOrWhiteSpace(txtBarcode.Text))
             {
                 errorProvider.SetError(txtBarcode, "Required");
             }
             else
             {
                 errorProvider.Clear();
                 double ITEM_ID;
                 clsUtility.ExecuteSQLQuery("SELECT * FROM ItemInformation WHERE  (Barcode LIKE '%" + txtBarcode.Text + "%')   ");
                 if (clsUtility.sqlDT.Rows.Count > 0)
                 {
                     errorProvider.Clear();
                     ITEM_ID = Convert.ToDouble(clsUtility.sqlDT.Rows[0]["ITEM_ID"]);
                     InsertSalesItem(ITEM_ID.ToString(), 1);
                     LoadSalesItem();
                     txtBarcode.Text = "";
                     txtBarcode.Focus();
                 }
                 else
                 {
                     clsUtility.MesgBoxShow("msgNotFound", "info");
                 }
             }
         }
         ///////////////////////////////////////////
     }
     else
     {
         clsUtility.MesgBoxShow("msgPermission", "err");
     }
 }
示例#9
0
        public void DestoryEnemies(Vector3 targetPos, ITEM_ID itemId)
        {
            Vector3[] range = GetDestroyRange(targetPos, itemId);

            List <GameObject> targetTiles = new List <GameObject>();

            foreach (GameObject obj in curTilesOnStage)
            {
                foreach (Vector3 v in range)
                {
                    if (obj.tag == "Wall")
                    {
                        continue;
                    }
                    if (obj.transform.position == v)
                    {
                        targetTiles.Add(obj);
                    }
                }
            }

            foreach (GameObject obj in curTrapsOnStage)
            {
                foreach (Vector3 v in range)
                {
                    if (obj.transform.position == v)
                    {
                        targetTiles.Add(obj);
                    }
                }
            }

            List <GameObject> targetEnemies = SearchEnemies(range);

            StartCoroutine(DestroyEffectFloor(targetTiles));
            StartCoroutine(DestroyEffect(targetEnemies));
        }
示例#10
0
        public void UseItem(int index)
        {
            if (index >= GameManager.instance.bag.Count)
            {
                return;
            }
            if (bHideMode)
            {
                BreakedHiding(LocalizationManager.instance.GetLocalString(GAME_STRING.HIDE_BROKEN_USE));
            }
            SoundManager.instance.PlaySingle(skillSound);
            string  name   = ItemManager.instance.GetNameByItemId(GameManager.instance.bag[index]);
            ITEM_ID itemId = GameManager.instance.bag[index];

            GameManager.instance.dungeonPlayData.useItems.Add(name);
            switch (itemId)
            {
            case ITEM_ID.HIDE: Hide(); break;

            case ITEM_ID.HEAL1: GameManager.instance.RecoverHP(1); break;

            case ITEM_ID.HEAL2: GameManager.instance.RecoverHP(2); break;

            case ITEM_ID.HEAL3: GameManager.instance.RecoverHP(3); break;

            case ITEM_ID.FRAGMENT_NEAR:
                GameManager.instance.ShowMap(transform.position, SHOW_TYPE.NEAR);
                break;

            case ITEM_ID.FRAGMENT_MONSTER:
                GameManager.instance.ShowMap(transform.position, SHOW_TYPE.MONSTER);
                break;

            case ITEM_ID.FRAGMENT_TRAP:
                GameManager.instance.ShowMap(transform.position, SHOW_TYPE.TRAP);
                break;

            case ITEM_ID.FRAGMENT_ITEM:
                GameManager.instance.ShowMap(transform.position, SHOW_TYPE.GEM_ITEM);
                break;

            case ITEM_ID.FRAGMENT_ALL:
                GameManager.instance.ShowMap(transform.position, SHOW_TYPE.ALL);
                break;

            case ITEM_ID.DESTROY_4D:
                GameManager.instance.DestoryEnemies(transform.position, ITEM_ID.DESTROY_4D);
                break;

            case ITEM_ID.DESTROY_LR:
                GameManager.instance.DestoryEnemies(transform.position, ITEM_ID.DESTROY_LR);
                break;

            case ITEM_ID.DESTROY_UD:
                GameManager.instance.DestoryEnemies(transform.position, ITEM_ID.DESTROY_UD);
                break;

            case ITEM_ID.ADD_TIME:
                GameManager.instance.AddTime(30);
                break;

            case ITEM_ID.STOP_TIME:
                GameManager.instance.StopTime(true);
                break;

            case ITEM_ID.ESCAPE:
                GameManager.instance.GotoDungeonMap();
                break;
            }

            Analytics.CustomEvent("Use Item", new Dictionary <string, object>
            {
                { "Item id", GameManager.instance.bag[index] },
                { "Dungeon id", GameManager.instance.GetDungeonInfo().id },
                { "Level id", GameManager.instance.GetDungeonInfo().GetCurLevel().id },
            });

            GameManager.instance.bag.RemoveAt(index);
        }