Exemplo n.º 1
0
 internal void OnSetDataOnSpecialItem(ArrayList array, ArrayList array1)
 {
     if (SpecialItemArray == null)
     {
         SpecialItemArray = new ArrayList();
     }
     if (SpecialItemKeyArray == null)
     {
         SpecialItemKeyArray = new ArrayList();
     }
     if (SpecialItemValueArray == null)
     {
         SpecialItemValueArray = new ArrayList();
     }
     NoItemMessage.SetActive(true);
     if (array.Count > 0)
     {
         NoItemMessage.SetActive(false);
     }
     if (SpecialItemArray.Count != array.Count)
     {
         OnRemoveAllObjects();
         for (int i = 0; i < array.Count; i++)
         {
             string           id   = array [i] as string;
             InventoryCellBtn cell = Instantiate(itemPrefeb, ScrollPanel.transform, false);
             cell.ItemId           = id;
             cell.ItemType         = "S";
             cell.txtNoOfCoin.text = (string)array1 [i];
             //			StartCoroutine (cell.LoadImg (url));
             SpecialItemArray.Add(cell);
             TaskScreenScript.instance.OnSetImages(id, cell.img);
         }
     }
 }
Exemplo n.º 2
0
 internal void OnSetItem()
 {
     if (SpecialItemArray == null)
     {
         SpecialItemArray = new ArrayList();
     }
     if (SpecialItemKeyArray == null)
     {
         SpecialItemKeyArray = new ArrayList();
     }
     if (SpecialItemValueArray == null)
     {
         SpecialItemValueArray = new ArrayList();
     }
     if (SpecialItemArray.Count != SpecialItemKeyArray.Count)
     {
         OnSetDataOnSpecialItem(SpecialItemKeyArray, SpecialItemValueArray);
     }
     else
     {
         for (int i = 0; i < SpecialItemArray.Count; i++)
         {
             InventoryCellBtn cell = SpecialItemArray [i] as InventoryCellBtn;
             cell.txtNoOfCoin.text = (string)SpecialItemValueArray [i];
         }
     }
 }
Exemplo n.º 3
0
 internal void OnRemoveAllObjects()
 {
     if (InventoryArray != null)
     {
         for (int i = 0; i < InventoryArray.Count; i++)
         {
             InventoryCellBtn obj = InventoryArray [i] as InventoryCellBtn;
             Destroy(obj.gameObject);
         }
     }
 }
Exemplo n.º 4
0
    internal void OnSettingPanelOpen()
    {
        ObjCharCamera.SetActive(true);
        RandomPlacement.instance.ChestInsertObject.SetActive(false);
        if (Constants.CharSelected == "Male")
        {
//			ImgCharacter.sprite = ImgMale;
            ObjMale.SetActive(true);
            ObjFemale.SetActive(false);
        }
        else
        {
//			ImgCharacter.sprite = ImgFemale;
            ObjMale.SetActive(false);
            ObjFemale.SetActive(true);
        }
        SoundManagerScript.instance.InMenuClicked();
        FindSoundOnOff();
//		Constants

        if (SpecialItemArray == null)
        {
            SpecialItemArray = new ArrayList();
        }
        if (SpecialItemKeyArray == null)
        {
            SpecialItemKeyArray = new ArrayList();
        }
        if (SpecialItemValueArray == null)
        {
            SpecialItemValueArray = new ArrayList();
        }
        NoItemMessage.SetActive(true);
        if (SpecialItemKeyArray.Count > 0)
        {
            NoItemMessage.SetActive(false);
        }
        if (SpecialItemArray.Count != SpecialItemKeyArray.Count)
        {
            OnSetDataOnSpecialItem(SpecialItemKeyArray, SpecialItemValueArray);
        }
        else
        {
            for (int i = 0; i < SpecialItemArray.Count; i++)
            {
                InventoryCellBtn cell = SpecialItemArray [i] as InventoryCellBtn;
                cell.txtNoOfCoin.text = (string)SpecialItemValueArray [i];
            }
        }
    }
Exemplo n.º 5
0
 internal void OnRemoveAllObjects()
 {
     if (SpecialItemArray != null)
     {
         if (SpecialItemArray.Count > 0)
         {
             for (int i = 0; i < SpecialItemArray.Count; i++)
             {
                 InventoryCellBtn obj = SpecialItemArray [i] as InventoryCellBtn;
                 Destroy(obj.gameObject);
             }
         }
     }
     SpecialItemArray      = new ArrayList();
     SpecialItemKeyArray   = new ArrayList();
     SpecialItemValueArray = new ArrayList();
 }
Exemplo n.º 6
0
    internal void OnSetDataOnInventory(ArrayList array, ArrayList array1)
    {
        if (InventoryArray == null)
        {
            InventoryArray = new ArrayList();
        }
        OnRemoveAllObjects();
        for (int i = 0; i < array.Count; i++)
        {
            string           id   = array [i] as string;
            InventoryCellBtn cell = Instantiate(itemPrefeb, ScrollPanel.transform, false);
            cell.ItemId           = id;
            cell.ItemType         = "I";
            cell.txtNoOfCoin.text = (string)array1 [i];
//			StartCoroutine (cell.LoadImg (url));
            InventoryArray.Add(cell);

            TaskScreenScript.instance.OnSetImages(id, cell.img);
//			if (i < TaskScreenScript.instance.BtnImgItem.Length) {
//				TaskScreenScript.instance.OnSetImages (id, TaskScreenScript.instance.BtnImgItem [i]);
//			}
        }
    }
Exemplo n.º 7
0
    internal void OnInventoryListResponse(JSONObject data)
    {
        if (UserSettingScript.instance.SpecialItemKeyArray == null)
        {
            UserSettingScript.instance.SpecialItemKeyArray = new ArrayList();
        }
        if (UserSettingScript.instance.SpecialItemValueArray == null)
        {
            UserSettingScript.instance.SpecialItemValueArray = new ArrayList();
        }
        if (InventoryListArray == null)
        {
            InventoryListArray = new ArrayList();
        }
        if (InventoryArray == null)
        {
            InventoryArray = new ArrayList();
        }
        if (InventoryCount == null)
        {
            InventoryCount = new ArrayList();
        }

        JSONObject jdata = data.GetField("data");

        NoItemMessage.SetActive(true);
        if (jdata.Count > 0)
        {
            NoItemMessage.SetActive(false);
        }
        if (jdata.Count != (InventoryListArray.Count + UserSettingScript.instance.SpecialItemKeyArray.Count))
        {
            OnRemoveAllObjects();
            UserSettingScript.instance.OnRemoveAllObjects();
            print(" JdataCount " + jdata.Count);
            InventoryCount     = new ArrayList();
            InventoryArray     = new ArrayList();
            InventoryListArray = new ArrayList();

            if (jdata.Count > 0)
            {
                string[] list = jdata.Print().Trim('"').ToString().Trim('"').ToString().Trim('{').ToString().Trim('}').Split(',');

                for (int i = 0; i < list.Length; i++)
                {
                    string[] newlist = list [i].ToString().Trim('"').Split(':');

                    int    value = int.Parse(newlist [1].ToString().Trim('"'));
                    string key   = newlist [0].ToString().Trim('"');
                    if (TaskScreenScript.instance.ItemType(key).ToUpper() == "S")
                    {
                        UserSettingScript.instance.SpecialItemKeyArray.Add(key.ToString());
                        UserSettingScript.instance.SpecialItemValueArray.Add(value.ToString());
                    }
                    else
                    {
                        InventoryCount.Add(value.ToString());
                        InventoryListArray.Add(key.ToString());
                    }

                    //				}
                }
            }
            if (InventoryArray.Count != InventoryListArray.Count)
            {
//				print ("18" + InventoryListArray.Count);
                OnSetDataOnInventory(InventoryListArray, InventoryCount);
                SwapItemScript.instance.OnSetAllItems(InventoryListArray, InventoryCount);
                UserSettingScript.instance.OnSetItem();
            }
        }
        else
        {
            UserSettingScript.instance.OnSetItem();
            for (int i = 0; i < InventoryArray.Count; i++)
            {
                InventoryCellBtn cell = InventoryArray [i] as InventoryCellBtn;
                cell.txtNoOfCoin.text = (string)InventoryCount [i];
            }
        }
    }