示例#1
0
    protected override void OnAwake()
    {
        base.OnAwake();
        this.m_tutorial = XSingleton <XInterfaceMgr> .singleton.GetInterface <IXTutorial>(XSingleton <XCommon> .singleton.XHash("XTutorial"));

        this.m_gameui = XSingleton <XInterfaceMgr> .singleton.GetInterface <IXGameUI>(XSingleton <XCommon> .singleton.XHash("XGameUI"));

        this.m_colliderCached = base.collider;
        if (null == this.m_colliderCached)
        {
            Debug.Log("null == m_colliderCached");
        }
        this.m_uiToggle = base.GetComponent <UIToggle>();
        if (null == this.m_uiToggle)
        {
            Debug.Log("null == m_uiToggle");
        }
        this.m_uiSpriteBG = base.GetComponentInChildren <UISprite>();
        if (null == this.m_uiSpriteBG)
        {
            Debug.Log("null == m_uiSpriteBG");
        }
        this.CloneFromTpl();
        if (this.m_NeedAudio && (string.IsNullOrEmpty(this.audioClip) || !this.audioClip.StartsWith("Audio")))
        {
            this.SetAudioClip("Audio/UI/UI_Button_ok");
        }
    }
示例#2
0
    protected override void OnAwake()
    {
        base.OnAwake();
        this.m_gameui = XSingleton <XInterfaceMgr> .singleton.GetInterface <IXGameUI>(XSingleton <XCommon> .singleton.XHash("XGameUI"));

        this.m_tutorial = XSingleton <XInterfaceMgr> .singleton.GetInterface <IXTutorial>(XSingleton <XCommon> .singleton.XHash("XTutorial"));

        this.m_operation = XSingleton <XInterfaceMgr> .singleton.GetInterface <IXOperationRecord>(XSingleton <XCommon> .singleton.XHash("XOperationRecord"));

        this.m_uiButton       = base.GetComponent <UIButton>();
        this.m_uiButtonColor  = this.m_uiButton;
        this.m_uiButtonScale  = base.GetComponent <UIButtonScale>();
        this.m_uiButtonOffset = base.GetComponent <UIButtonOffset>();
        this.m_uiSpriteBG     = base.GetComponentInChildren <UISprite>();
        if (this.m_uiButton != null)
        {
            this.m_colliderCached = this.m_uiButton.cacheCol;
        }
        else
        {
            this.m_colliderCached = base.GetComponent <Collider>();
        }
        this.CloneFromTpl();
        if (this.m_NeedAudio && (string.IsNullOrEmpty(this.audioClip) || !this.audioClip.StartsWith("Audio")))
        {
            this.SetAudioClip("Audio/UI/UI_Button_ok");
        }
        this.m_CD.SetClickCD(this.CustomClickCDGroup, this.CustomClickCD);
        if (this.m_uiButton != null)
        {
            this.m_uiButton.changeStateSprite = this.ChangeStateSprite;
        }
    }
示例#3
0
    private void Awake()
    {
        this._game_ui = XSingleton <XInterfaceMgr> .singleton.GetInterface <IXGameUI>(XSingleton <XCommon> .singleton.XHash("XGameUI"));

        this._game_ui.UICamera = base.gameObject.GetComponent <Camera>();
        Transform parent = base.transform.parent;

        this._game_ui.UIRoot = parent;
        UIRoot component = parent.GetComponent <UIRoot>();

        this._game_ui.Base_UI_Width  = component.base_ui_width;
        this._game_ui.Base_UI_Height = component.base_ui_height;
        XSingleton <XUICommon> .singleton.Init(parent);
    }
示例#4
0
    protected override void OnAwake()
    {
        base.OnAwake();
        this.m_gameui = XSingleton <XInterfaceMgr> .singleton.GetInterface <IXGameUI>(XSingleton <XCommon> .singleton.XHash("XGameUI"));

        this.m_tutorial = XSingleton <XInterfaceMgr> .singleton.GetInterface <IXTutorial>(XSingleton <XCommon> .singleton.XHash("XTutorial"));

        this.m_operation = XSingleton <XInterfaceMgr> .singleton.GetInterface <IXOperationRecord>(XSingleton <XCommon> .singleton.XHash("XOperationRecord"));

        this.m_uiSprite = base.GetComponent <UISprite>();
        if (!string.IsNullOrEmpty(this.SpriteAtlasPath))
        {
            IPlatform xPlatform = XSingleton <XUpdater> .singleton.XPlatform;
            if (xPlatform.IsUIDelayLoad() && !string.IsNullOrEmpty(this.HalfPath))
            {
                XUITool.Instance.XGameUI.DelayLoadUISprite(this);
            }
            else if (!string.IsNullOrEmpty(this.HalfPath) && xPlatform.IsUIHalfResolution())
            {
                this.SetSprite(this.SPriteName, this.HalfPath);
            }
            else
            {
                this.SetSprite(this.SPriteName, this.SpriteAtlasPath);
            }
        }
        if (null == this.m_uiSprite)
        {
            Debug.Log("null == m_uiSprite," + base.gameObject.name);
        }
        this.m_sourceColor = this.m_uiSprite.color;
        this.CloneFromTpl();
        if (this.m_NeedAudio && (string.IsNullOrEmpty(this.audioClip) || !this.audioClip.StartsWith("Audio")))
        {
            this.SetAudioClip("Audio/UI/UI_Button_ok");
        }
        this.m_CD.SetClickCD(this.CustomClickCDGroup, this.CustomClickCD);
        this.ClickCanceled = false;
    }
 private void Awake()
 {
     this.m_game_ui = XSingleton <XInterfaceMgr> .singleton.GetInterface <IXGameUI>(XSingleton <XCommon> .singleton.XHash("XGameUI"));
 }
    private void Awake()
    {
        if (this.m_CachedDlg == null)
        {
            this.m_CachedDlg = base.gameObject;
        }
        if (this.m_CachedDlg.GetComponent <UISprite>() == null)
        {
            this.m_CachedDlg.AddComponent <UISprite>();
        }
        base.transform.GetComponent <UIPlayTween>().tweenTarget = this.m_CachedDlg;
        this.m_gameui = XSingleton <XInterfaceMgr> .singleton.GetInterface <IXGameUI>(XSingleton <XCommon> .singleton.XHash("XGameUI"));

        GameObject dlgControllerTpl = this.m_gameui.DlgControllerTpl;
        bool       flag             = false;
        bool       flag2            = false;

        TweenScale[] components = this.m_CachedDlg.GetComponents <TweenScale>();
        for (int i = 0; i < components.Length; i++)
        {
            if (components[i].tweenGroup == 1)
            {
                flag = true;
            }
            if (components[i].tweenGroup == 2)
            {
                flag2 = true;
            }
        }
        components = dlgControllerTpl.GetComponents <TweenScale>();
        for (int j = 0; j < components.Length; j++)
        {
            if (!flag || components[j].tweenGroup != 1)
            {
                if (!flag2 || components[j].tweenGroup != 2)
                {
                    TweenScale tweenScale = this.m_CachedDlg.AddComponent <TweenScale>();
                    tweenScale.from            = components[j].from;
                    tweenScale.to              = components[j].to;
                    tweenScale.style           = components[j].style;
                    tweenScale.animationCurve  = components[j].animationCurve;
                    tweenScale.duration        = components[j].duration;
                    tweenScale.delay           = components[j].delay;
                    tweenScale.tweenGroup      = components[j].tweenGroup;
                    tweenScale.ignoreTimeScale = components[j].ignoreTimeScale;
                    tweenScale.enabled         = false;
                }
            }
        }
        flag  = false;
        flag2 = false;
        TweenPosition[] components2 = this.m_CachedDlg.GetComponents <TweenPosition>();
        for (int k = 0; k < components2.Length; k++)
        {
            if (components2[k].tweenGroup == 1)
            {
                flag = true;
            }
            if (components2[k].tweenGroup == 2)
            {
                flag2 = true;
            }
        }
        components2 = dlgControllerTpl.GetComponents <TweenPosition>();
        for (int l = 0; l < components2.Length; l++)
        {
            if (!flag || components2[l].tweenGroup != 1)
            {
                if (!flag2 || components2[l].tweenGroup != 2)
                {
                    TweenPosition tweenPosition = this.m_CachedDlg.AddComponent <TweenPosition>();
                    tweenPosition.from            = components2[l].from;
                    tweenPosition.to              = components2[l].to;
                    tweenPosition.style           = components2[l].style;
                    tweenPosition.animationCurve  = components2[l].animationCurve;
                    tweenPosition.duration        = components2[l].duration;
                    tweenPosition.delay           = components2[l].delay;
                    tweenPosition.tweenGroup      = components2[l].tweenGroup;
                    tweenPosition.ignoreTimeScale = components2[l].ignoreTimeScale;
                    tweenPosition.enabled         = false;
                }
            }
        }
        flag  = false;
        flag2 = false;
        TweenAlpha[] components3 = this.m_CachedDlg.GetComponents <TweenAlpha>();
        for (int m = 0; m < components3.Length; m++)
        {
            if (components3[m].tweenGroup == 1)
            {
                flag = true;
            }
            if (components3[m].tweenGroup == 2)
            {
                flag2 = true;
            }
        }
        components3 = dlgControllerTpl.GetComponents <TweenAlpha>();
        for (int n = 0; n < components3.Length; n++)
        {
            if (!flag || components3[n].tweenGroup != 1)
            {
                if (!flag2 || components3[n].tweenGroup != 2)
                {
                    TweenAlpha tweenAlpha = this.m_CachedDlg.AddComponent <TweenAlpha>();
                    tweenAlpha.from            = components3[n].from;
                    tweenAlpha.to              = components3[n].to;
                    tweenAlpha.style           = components3[n].style;
                    tweenAlpha.animationCurve  = components3[n].animationCurve;
                    tweenAlpha.duration        = components3[n].duration;
                    tweenAlpha.delay           = components3[n].delay;
                    tweenAlpha.tweenGroup      = components3[n].tweenGroup;
                    tweenAlpha.ignoreTimeScale = components3[n].ignoreTimeScale;
                    tweenAlpha.enabled         = false;
                }
            }
        }
    }