////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 void Awake()
 {
     mFade = new SmoothStep(0.0f,1.0f,1.0f,false);
     mParent = transform.parent;
     if(mParent!=null){
         mButton = mParent.GetComponent<BasicButton>();
     }
 }
 public ExtendedButton(Rect r, Texture down, Texture up, Texture disableDown, Texture disableUp, bool bKeepSt = true, int shadowDist = 1)
     : base(r,down,up,disableDown,disableUp,bKeepSt)
 {
     mMoveX = new SmoothStep(r.x, r.x, 1.0f, false);
     mMoveY = new SmoothStep(r.y, r.y, 1.0f, false);
     //mAlpha=1.0f;
     mFade = new SmoothStep(1.0f, 1.0f, 1.0f, false);
     mSizeX = new SmoothStep(r.width, r.width, 1.0f, false);
     mSizeY = new SmoothStep(r.height, r.height, 1.0f, false);
     LimitAlphaUpdate = -1;
     ShadowDist=shadowDist;
 }
Example #3
0
 protected virtual void Start()
 {
     mEnable = false;
     mAlpha = new SmoothStep(0, 1, Globals.ANIMATIONDURATION, false, 0);
     Tint.a = 0;
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 void Awake()
 {
     mFade = new SmoothStep(0.0f,0.0f,1.0f,false);
 }
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    void Awake()
    {
        renderer.material.mainTexture = texUnchecked;

        mGUIText = transform.FindChild("GUI Text");
        mGUITextBottom = transform.FindChild("GUI Text Bottom");
        /*Transform t = transform.FindChild("New Text");
        if(t != null)
            mText3D = transform.FindChild("New Text").GetComponent<TextMesh>();*/

        Color c = renderer.material.color;
        renderer.material.color = new Color(c.r, c.g, c.b, 0.0f);

        mFade = new SmoothStep(0.0f, 0.0f, 1.0f, false);
        mMoveY = new SmoothStep(0.0f,0.0f,1.0f,false);
    }
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    void Awake()
    {
        listButtons = new List<GameObject>();
        mGUIManager = transform.parent.GetComponent<GUIManager>();

        mFade = new SmoothStep(0.0f,0.0f,1.0f,false);
        mMoveY = new SmoothStep(0.0f,0.0f,1.0f,false);

        mSpeedsY = new float[Globals.SPEEDS];
        mSpeedPos = 0;
        mSpeed = new SmoothStep(0, 0, Globals.BRAKEDURATION, false, 0);

        state=States.hidden;
    }
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static void Init(float animationDuration)
        {
            mBUTTONS_SEPARATION = Mathf.RoundToInt(BUTTONS_SEPARATION * ButtonProperties.scaleCorrectionX);
            //mTEXT_MARGIN = Mathf.RoundToInt(TEXT_MARGIN  * ButtonProperties.scaleCorrectionX);
            //mTEXT_BUTTON_MARGIN = Mathf.RoundToInt(TEXT_BUTTON_MARGIN * ButtonProperties.scaleCorrectionX);
            int mDIALOG_W = Mathf.RoundToInt(DIALOG_W * ButtonProperties.scaleCorrectionX);
            int mDIALOG_H = Mathf.RoundToInt(DIALOG_H * ButtonProperties.scaleCorrectionX);
            int mTITLE_FONT_SIZE = Mathf.RoundToInt(CAPTION_FONT_SIZE * ButtonProperties.scaleCorrectionX);
            int mBUTTON_FONT_SIZE = Mathf.RoundToInt(BUTTON_FONT_SIZE * ButtonProperties.scaleCorrectionX);
            int mDIALOG_Y = Mathf.RoundToInt(DIALOG_Y * ButtonProperties.scaleCorrectionY);
            mBUTTONS_Y = Mathf.RoundToInt(mDIALOG_H + mDIALOG_Y + ButtonProperties.buttonMargin);

            int mCAPTION_Y = Mathf.RoundToInt(CAPTION_Y * ButtonProperties.scaleCorrectionY);
            int mCAPTION_W = Mathf.RoundToInt(CAPTION_W * ButtonProperties.scaleCorrectionX);
            int mMESSAGE_Y = Mathf.RoundToInt(MESSAGE_Y * ButtonProperties.scaleCorrectionY);
            int mMESSAGE_W = Mathf.RoundToInt(MESSAGE_W * ButtonProperties.scaleCorrectionX);

            Font font = (Font)ResourcesManager.LoadResource("Interface/Fonts/Futura Oblique", "Message");
            Texture buttonUp = (Texture)ResourcesManager.LoadResource("Interface/Textures/Warning/button", "Message");
            Texture buttonDown = (Texture)ResourcesManager.LoadResource("Interface/Textures/Warning/button_pressed", "Message");
            mTexDialog = (Texture2D)ResourcesManager.LoadResource("Interface/Textures/Warning/window", "Message");

            mStyle1 = new GUIStyle();
            mStyle1.font = font;
            mStyle1.clipping = TextClipping.Clip;
            mStyle1.wordWrap = true;
            mStyle1.fontSize = mTITLE_FONT_SIZE;
            mStyle1.alignment = TextAnchor.UpperCenter;
            mStyle1.fontStyle = FontStyle.Bold;
            mStyle1.normal.textColor = Color.black;

            mStyle2 = new GUIStyle();
            mStyle2.font = font;
            mStyle2.clipping = TextClipping.Clip;
            mStyle2.wordWrap = true;
            mStyle2.fontSize = mBUTTON_FONT_SIZE;
            //mStyle2.alignment = TextAnchor.UpperCenter;
            mStyle2.alignment = TextAnchor.MiddleCenter;
            mStyle2.fontStyle = FontStyle.Normal;
            mStyle2.normal.textColor = new Color(0f, 0f, 0f, 0.5f);

            mAnimationDuration = animationDuration;

            mYesButton = new TextButton(new Rect(0, 0, 0, 0), buttonDown, buttonUp, buttonDown, buttonUp, font, false);
            mYesButton.TextSize = mBUTTON_FONT_SIZE;
            mYesButton.TextStyle = FontStyle.Normal;
            mYesButton.TextPosition = TextAnchor.MiddleCenter;
            mYesButton.shadow = true;
            mYesButton.TextColor = Color.white;
            mYesButton.scaleMode = ScaleMode.StretchToFill;
            mYesButton.enable = false;

            mNoButton = new TextButton(new Rect(0, 0, 0, 0), buttonDown, buttonUp, buttonDown, buttonUp, font, false);
            mNoButton.TextSize = mBUTTON_FONT_SIZE;
            mNoButton.TextStyle = FontStyle.Normal;
            mNoButton.TextPosition = TextAnchor.MiddleCenter;
            mNoButton.Text = "No";
            mNoButton.shadow = true;
            mNoButton.TextColor = Color.white;
            mNoButton.scaleMode = ScaleMode.StretchToFill;
            mNoButton.enable = false;

            mNoButton.Position(new Rect((Screen.width + mBUTTONS_SEPARATION) / 2, mBUTTONS_Y, ButtonProperties.buttonSize, ButtonProperties.buttonSize));

            mState = States.Hide;
            mAlpha = new SmoothStep(0, 0, 0, false, 0);

            //mBlack = (Texture2D)ResourcesManager.LoadResource("SceneMgr/black_pixel", "Message");
            //mRBlack = new Rect(0, 0, Screen.width, Screen.height);

            mRTexDialog = new Rect((Screen.width - mDIALOG_W) / 2, mDIALOG_Y, mDIALOG_W, mDIALOG_H);
            mRCaption = new Rect((Screen.width - mCAPTION_W) / 2, mCAPTION_Y, mCAPTION_W, 42 * ButtonProperties.scaleCorrectionY);
            mRMessage = new Rect((Screen.width - mMESSAGE_W) / 2, mMESSAGE_Y, mMESSAGE_W, 84 * ButtonProperties.scaleCorrectionY);
        }
 void Awake()
 {
     DontDestroyOnLoad(this);
     mInstance = this;
     mOriginalColor = new Color(1.0f, 1.0f, 1.0f, 1.0f);
     mCurrentColor = new Color(1.0f, 1.0f, 1.0f, 0.0f);
     mScreenRect = new Rect(0.0f, 0.0f, Screen.width, Screen.height);
     mState = States.NONE;
     mAlpha = new SmoothStep(0f, 1f, Globals.ANIMATIONDURATION, false);
     Init();
 }