コード例 #1
0
ファイル: DropLight.cs プロジェクト: hackerlank/UnityGameSrc
 protected void Awake()
 {
     this.Tm               = base.transform;
     this.SpriteRenderer   = GameObjectExtensions.AddOrGetComponent <UnityEngine.SpriteRenderer>(base.gameObject);
     this.Tm.localRotation = Quaternion.Euler(90f, 0f, 0f);
     this.initialize();
 }
コード例 #2
0
        protected void Awake()
        {
            this.RectTm = base.GetComponent <RectTransform>();
            Transform[] children = TransformExtensions.GetChildren(this.LockedContentRoot.transform, false);
            for (int i = 0; i < children.Length; i++)
            {
                TransformAnimation item = GameObjectExtensions.AddOrGetComponent <TransformAnimation>(children[i].gameObject);
                this.m_lockedContentTransformAnimations.Add(item);
                RectTransform transform = children[i].GetComponent <RectTransform>();
                this.m_lockedContentRectTransforms.Add(item, transform);
                this.m_lockedContentOriginalAnchoredPositions.Add(item, transform.anchoredPosition);
                Image       image   = children[i].GetComponent <Image>();
                MenuOverlay overlay = GameObjectExtensions.AddOrGetComponent <MenuOverlay>(children[i].gameObject);
                overlay.Image = image;
                this.m_lockedContentImages.Add(item, overlay);
            }
            this.m_dummyRectTmObj           = new GameObject("DummyRectTm").AddComponent <RectTransform>();
            this.m_dummyRectTmObj.sizeDelta = Vector2.zero;
            this.m_dummyRectTmObj.SetParent(this.LockedContentRoot.transform, false);
            this.m_dimmableImages.Clear();
            Image component = this.BackgroundCanvas.GetComponent <Image>();

            this.m_dimmableImages.Add(component);
            this.m_dimmableImageOriginalColors.Add(component, component.color);
            Image[] componentsInChildren = this.OpenContentRoot.GetComponentsInChildren <Image>();
            for (int j = 0; j < componentsInChildren.Length; j++)
            {
                this.m_dimmableImages.Add(componentsInChildren[j]);
                this.m_dimmableImageOriginalColors.Add(componentsInChildren[j], componentsInChildren[j].color);
            }
        }
コード例 #3
0
 protected void Awake()
 {
     this.Tm                  = base.transform;
     this.SpriteRenderer      = GameObjectExtensions.AddOrGetComponent <UnityEngine.SpriteRenderer>(base.gameObject);
     this.Billboard           = GameObjectExtensions.AddOrGetComponent <PlayerView.Billboard>(base.gameObject);
     this.m_randFlickerOffset = UnityEngine.Random.Range((float)0f, (float)100f);
     this.initialize();
 }
コード例 #4
0
        public void refresh()
        {
            Slider slider = GameObjectExtensions.AddOrGetComponent <Slider>(base.gameObject);

            slider.normalizedValue = 1f;
            if (this.Background != null)
            {
                this.Background.anchorMin     = Vector2.zero;
                this.Background.anchorMax     = Vector2.one;
                this.Background.pivot         = (Vector2)(Vector2.one * 0.5f);
                this.Background.localRotation = Quaternion.identity;
                this.Background.localScale    = Vector3.one;
            }
            if (this.ForegroundMask != null)
            {
                slider.fillRect                        = this.ForegroundMask;
                this.ForegroundMask.pivot              = (Vector2)(Vector2.one * 0.5f);
                this.ForegroundMask.localRotation      = Quaternion.identity;
                this.ForegroundMask.localScale         = Vector3.one;
                this.ForegroundMask.anchoredPosition3D = Vector3.zero;
                this.ForegroundMask.sizeDelta          = Vector2.zero;
                GameObjectExtensions.AddOrGetComponent <Mask>(this.ForegroundMask.gameObject).showMaskGraphic = false;
                Image image = GameObjectExtensions.AddOrGetComponent <Image>(this.ForegroundMask.gameObject);
                image.sprite = null;
                image.color  = new Color(0.9882353f, 0.2588235f, 0.8470588f, 0.3843137f);
            }
            if (this.Foreground != null)
            {
                this.Foreground.anchorMin          = Vector2.zero;
                this.Foreground.anchorMax          = Vector2.one;
                this.Foreground.pivot              = new Vector2(0f, 0.5f);
                this.Foreground.localRotation      = Quaternion.identity;
                this.Foreground.localScale         = Vector3.one;
                this.Foreground.anchoredPosition3D = new Vector3(this.ForegroundMargin, 0f, 0f);
                RectTransformExtensions.SetTop(this.Foreground, -this.ForegroundMargin);
                RectTransformExtensions.SetBottom(this.Foreground, this.ForegroundMargin);
                LayoutElement element = GameObjectExtensions.AddOrGetComponent <LayoutElement>(this.Foreground.gameObject);
                if ((this.ForegroundMask != null) && (this.ForegroundMask.rect.width > 0f))
                {
                    element.minWidth = this.ForegroundMask.rect.width - (this.ForegroundMargin * 2f);
                }
                ContentSizeFitter fitter = GameObjectExtensions.AddOrGetComponent <ContentSizeFitter>(this.Foreground.gameObject);
                fitter.horizontalFit = ContentSizeFitter.FitMode.MinSize;
                fitter.verticalFit   = ContentSizeFitter.FitMode.Unconstrained;
                GameObjectExtensions.AddOrGetComponent <Image>(this.Foreground.gameObject);
            }
        }
コード例 #5
0
 protected void Awake()
 {
     this.Tm = base.transform;
     this.TransformAnimation = GameObjectExtensions.AddOrGetComponent <TransformAnimation>(base.gameObject);
     for (int i = 0; i < this.CoinRenderers.Count; i++)
     {
         RendererData item = new RendererData();
         item.Transform          = this.CoinRenderers[i].transform;
         item.SpriterRenderer    = this.CoinRenderers[i];
         item.TransformAnimation = GameObjectExtensions.AddOrGetComponent <TransformAnimation>(item.SpriterRenderer.gameObject);
         item.LocalScale         = item.Transform.localScale;
         item.Billboard          = false;
         this.m_coinRenderers.Add(item);
     }
     for (int j = 0; j < this.DiamondRenderers.Count; j++)
     {
         RendererData data2 = new RendererData();
         data2.Transform          = this.DiamondRenderers[j].transform;
         data2.SpriterRenderer    = this.DiamondRenderers[j];
         data2.TransformAnimation = GameObjectExtensions.AddOrGetComponent <TransformAnimation>(data2.SpriterRenderer.gameObject);
         data2.LocalScale         = data2.Transform.localScale;
         data2.Billboard          = false;
         this.m_diamondRenderers.Add(data2);
     }
     for (int k = 0; k < this.XpRenderers.Count; k++)
     {
         RendererData data3 = new RendererData();
         data3.Transform          = this.XpRenderers[k].transform;
         data3.SpriterRenderer    = this.XpRenderers[k];
         data3.TransformAnimation = GameObjectExtensions.AddOrGetComponent <TransformAnimation>(data3.SpriterRenderer.gameObject);
         data3.LocalScale         = data3.Transform.localScale;
         data3.Billboard          = true;
         this.m_xpRenderers.Add(data3);
     }
     this.m_originalChestSpriteSortingOrder = this.Chest2dRenderer.sortingOrder;
 }
コード例 #6
0
ファイル: MenuHudTop.cs プロジェクト: hackerlank/UnityGameSrc
 protected void Awake()
 {
     GameObjectExtensions.AddOrGetComponent <TransformAnimation>(this.DiamondsIcon.gameObject);
     this.ResourceGainVisualizer = base.gameObject.AddComponent <PlayerView.ResourceGainVisualizer>();
 }
コード例 #7
0
 protected void Awake()
 {
     this.Text = GameObjectExtensions.AddOrGetComponent <UnityEngine.UI.Text>(base.gameObject);
 }
コード例 #8
0
ファイル: ScalePulse.cs プロジェクト: hackerlank/UnityGameSrc
 protected void Awake()
 {
     this.m_ta      = GameObjectExtensions.AddOrGetComponent <TransformAnimation>(base.gameObject);
     this.m_enabled = this.PLAY_ON_AWAKE;
 }