コード例 #1
0
    public void OpenWindow(NestedWeightedRewardPack nestedRewardPack)
    {
        currentRewardPack = nestedRewardPack.GetPackByWeight(out packIndex);
        currentRewardPack.Use();

        if (nestedRewardPack.Packs.Count != count)
        {
            return;
        }

        spinButton.gameObject.SetActive(true);

        var t = startOffsetDeg * Mathf.Deg2Rad;

        for (int i = 0; i < count; i++)
        {
            var pack = nestedRewardPack.Packs[i];
            for (int j = 0; j < pack.Rewards.Count; j++)
            {
                var rewardSource = pack.Rewards[j];
                var cloned       = pool.GetOrInstantiate(rewardSource.Source.TypeId);
                cloned.Source = rewardSource;
                cloned.Init();
                cloned.transform.localPosition    = new Vector3(radius * Mathf.Cos(t), radius * Mathf.Sin(t));
                cloned.transform.localEulerAngles = new Vector3(0, 0, t * Mathf.Rad2Deg + rotateElementOffsetDeg);
            }
            t += delta;
        }
        OpenWindow();
    }
コード例 #2
0
    public override void OpenWindow()
    {
        for (int j = 0; j < pack.Rewards.Count; j++)
        {
            var rewardSource = pack.Rewards[j];
            var cloned       = pool.GetOrInstantiate(rewardSource.Source.TypeId);
            cloned.Source = rewardSource;
            cloned.Init();
        }

        base.OpenWindow();
    }