Ejemplo n.º 1
0
 private void Update()
 {
     if (this.m_gui.activeSelf)
     {
         float deltaTime = Time.deltaTime;
         if (this.m_curSpeed > 0.01f)
         {
             for (int i = 0; i < this.m_displayItems.Length; i++)
             {
                 Vector3 localPosition = this.m_displayItems[i].transform.localPosition;
                 this.m_displayItems[i].transform.localPosition += Vector3.right * deltaTime * this.m_curSpeed;
                 if (this.m_displayItems[i].transform.localPosition.x > 0.085f)
                 {
                     this.m_displayItems[i].transform.localPosition -= Vector3.right * 0.6f;
                     int a_newDefId = 0;
                     if (this.m_curSpeed < 0.2f && !this.m_setWinningItemFlag)
                     {
                         a_newDefId = this.m_itemDefToWin;
                         this.m_setWinningItemFlag = true;
                     }
                     this.ChangeItem(i, a_newDefId);
                 }
                 if (localPosition.x < 0.015f && 0.015f < this.m_displayItems[i].transform.localPosition.x && null != base.audio)
                 {
                     base.audio.Play();
                 }
             }
             if (Time.time > this.m_timeToSlowdown)
             {
                 this.m_curSpeed *= 1f - deltaTime * this.m_slowDownRate;
             }
         }
         else if (!this.m_btnClose.activeSelf)
         {
             JSONNode item = JsonItems.GetItem(this.m_itemDefToWin);
             if (null != item)
             {
                 this.m_newItemTxt.text = LNG.Get("STEAM_INV_NEW_ITEM") + "\n " + item["market_name"];
                 if (null != this.m_client)
                 {
                     this.m_client.SendChatMsg(":#~" + item["market_name"], false);
                 }
                 else
                 {
                     ComChatGUI comChatGUI = UnityEngine.Object.FindObjectOfType <ComChatGUI>();
                     comChatGUI.AddString("Ethan The just opened a case and received: \n<color=\"red\">" + item["market_name"] + "</color>");
                 }
             }
             GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(this.m_audioEffect);
             gameObject.audio.clip   = this.m_successSound;
             gameObject.audio.volume = 0.4f;
             gameObject.audio.Play();
             this.m_btnClose.SetActive(true);
         }
     }
     if (Application.isEditor && Input.GetKeyDown(KeyCode.L))
     {
         this.Showtime(20009, 1004);
     }
 }
Ejemplo n.º 2
0
    private void GetItemDefsFromGenerator(int a_generatorDef)
    {
        JSONNode item = JsonItems.GetItem(a_generatorDef);

        if (null != item)
        {
            string   text  = item["bundle"];
            string[] array = text.Split(new char[]
            {
                ';'
            });
            this.m_generatorDefIds = new int[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                string[] array2 = array[i].Split(new char[]
                {
                    'x'
                });
                try
                {
                    this.m_generatorDefIds[i] = int.Parse(array2[0]);
                }
                catch (Exception)
                {
                }
            }
        }
    }
Ejemplo n.º 3
0
    private void ChangeItem(int a_index, int a_newDefId = 0)
    {
        int num  = a_newDefId;
        int num2 = 0;

        UnityEngine.Random.seed = (int)(Time.time * 1000f);
        while (num == 0 && this.m_generatorDefIds != null && 0 < this.m_generatorDefIds.Length)
        {
            num = this.m_generatorDefIds[UnityEngine.Random.Range(0, this.m_generatorDefIds.Length)];
            for (int i = 0; i < this.m_displayDefIds.Length; i++)
            {
                if (num == this.m_displayDefIds[i] && 100 > num2)
                {
                    num = 0;
                    num2++;
                    break;
                }
            }
        }
        JSONNode item = JsonItems.GetItem(num);

        if (null != item && a_index < this.m_displayItems.Length && num != this.m_displayDefIds[a_index])
        {
            this.m_displayDefIds[a_index]     = num;
            this.m_displayTexts[a_index].text = string.Concat(new string[]
            {
                "<color=#",
                item["name_color"],
                ">",
                item["market_name"],
                "</color>"
            });
            this.m_displayRenderers[a_index].renderer.material.mainTexture = Resources.Load <Texture>("inventory_steam/inventory_s_" + num);
        }
    }
Ejemplo n.º 4
0
    public void ShowGui(bool a_show, int a_itemDefId = 0)
    {
        if (a_show)
        {
            JSONNode item = JsonItems.GetItem(a_itemDefId);
            if (null != item && null != this.m_itemText && null != this.m_itemRenderer)
            {
                this.m_itemText.text = string.Concat(new string[]
                {
                    "<color=#",
                    item["name_color"],
                    ">",
                    item["market_name"],
                    "</color>"
                });
                this.m_itemRenderer.renderer.material.mainTexture = Resources.Load <Texture>("inventory_steam/inventory_s_" + a_itemDefId);
            }
            base.audio.Play();
        }
        this.m_guiParent.SetActive(a_show);
        int @int = PlayerPrefs.GetInt("prefSteamDropCount", 0);

        PlayerPrefs.SetInt("prefSteamDropCount", @int + 1);
        this.m_reviewText.text = LNG.Get((@int % 2 != 1) ? "STEAM_BLUE_ICON" : "STEAM_PLEASE_REVIEW");
    }
Ejemplo n.º 5
0
    private void UpdateInventoryDisplay()
    {
        if (this.m_items != null)
        {
            for (int i = 0; i < this.m_items.Length; i++)
            {
                UnityEngine.Object.Destroy(this.m_items[i]);
            }
            this.m_items = null;
        }
        int num = this.m_curPage * 16;

        if (this.m_itemDetails != null && num < this.m_itemDetails.Count)
        {
            int num2 = num + 15;
            this.m_items = new GameObject[Mathf.Min(this.m_itemDetails.Count - num, 16)];
            for (int j = 0; j < this.m_itemDetails.Count; j++)
            {
                if (j >= num && j <= num2)
                {
                    int      num3 = j - num;
                    JSONNode item = JsonItems.GetItem(this.m_itemDetails[j].m_iDefinition.m_SteamItemDef);
                    if (null != item)
                    {
                        this.m_items[num3] = (GameObject)UnityEngine.Object.Instantiate(this.m_itemPrefab);
                        this.m_items[num3].transform.parent        = base.transform;
                        this.m_items[num3].transform.localPosition = new Vector3(-0.01f + (float)(num3 % 4) * 0.278f, (float)(num3 / 4) * -0.278f, -0.01f);
                        this.m_items[num3].transform.localRotation = Quaternion.identity;
                        TextMesh componentInChildren = this.m_items[num3].GetComponentInChildren <TextMesh>();
                        componentInChildren.text = string.Concat(new string[]
                        {
                            "<color=#",
                            item["name_color"],
                            ">",
                            item["market_name"],
                            "</color>"
                        });
                        MeshCollider componentInChildren2 = this.m_items[num3].GetComponentInChildren <MeshCollider>();
                        componentInChildren2.renderer.material.mainTexture = Resources.Load <Texture>("inventory_steam/inventory_s_" + this.m_itemDetails[j].m_iDefinition.m_SteamItemDef);
                        componentInChildren2.transform.name = "sii-" + j.ToString();
                    }
                }
            }
        }
        this.m_txtPage.text = string.Empty;
        int num4 = (this.m_itemDetails.Count - 1) / 16 + 1;

        if (1 < num4)
        {
            for (int k = 1; k < num4 + 1; k++)
            {
                string str = k.ToString() + " ";
                if (this.m_curPage + 1 == k)
                {
                    str = "<color=\"#ffffff\">" + str + "</color>";
                }
                if (k < 10)
                {
                    str = " " + str;
                }
                TextMesh txtPage = this.m_txtPage;
                txtPage.text += str;
            }
        }
    }