Esempio n. 1
0
 public bool GetReward(out LootWheelRewards.LootWheelReward reward)
 {
     if (this.m_rewardIndex < this.m_rewards.Length && this.m_rewardIndex >= 0)
     {
         reward = this.m_rewards[this.m_rewardIndex++];
         return(true);
     }
     reward = LootWheelRewards.LootWheelReward.Empty;
     return(false);
 }
Esempio n. 2
0
    private GameObject InstantiateRewardImage(Transform root, LootWheelRewards.LootWheelReward reward)
    {
        GameObject gameObject = root.parent.Find("Label").gameObject;

        LootWheelRewards.RewardType type = reward.Type;
        GameObject gameObject2;

        if (type != LootWheelRewards.RewardType.Part)
        {
            if (type != LootWheelRewards.RewardType.Scrap)
            {
                return(null);
            }
            gameObject.SetActive(true);
            gameObject2 = UnityEngine.Object.Instantiate <GameObject>(this.scrapIconPrefab);
            GameObject gameObject3 = UnityEngine.Object.Instantiate <GameObject>(this.genericTextPrefab);
            gameObject3.transform.parent        = gameObject.transform;
            gameObject3.transform.localPosition = Vector3.zero;
            gameObject3.transform.position     += new Vector3(0f, -0.05f, -0.1f);
            gameObject3.transform.localScale    = new Vector3(0.08f, 0.08f, 1f);
            TextMesh[] componentsInChildren = gameObject3.GetComponentsInChildren <TextMesh>();
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                componentsInChildren[i].alignment = TextAlignment.Center;
                componentsInChildren[i].anchor    = TextAnchor.MiddleCenter;
                componentsInChildren[i].text      = reward.Amount.ToString();
            }
            this.SetLayer(gameObject3, base.gameObject.layer);
            this.SetSortingLayer(gameObject3, "Popup");
            this.SetOrderInLayer(gameObject3, 0);
        }
        else
        {
            gameObject2 = UnityEngine.Object.Instantiate <GameObject>(reward.PartReward.m_constructionIconSprite.gameObject);
            gameObject.SetActive(false);
        }
        gameObject2.transform.parent        = root;
        gameObject2.transform.localPosition = Vector3.zero;
        this.SetSortingLayer(gameObject2, "Popup");
        this.SetLayer(gameObject2, base.gameObject.layer);
        this.SetOrderInLayer(gameObject2, 0);
        return(gameObject2);
    }