Example #1
0
	void Start(){
		if(Application.isPlaying == true){
			selectPlayer = PlayerPrefs.GetInt("SelectPlayer");
			instace = this;
			calOnGUI = GetComponent<CalOnGUI>();
			StartCoroutine(WaitLoading());
		}
	}
Example #2
0
 void Start()
 {
     if (Application.isPlaying == true)
     {
         instace  = this;
         calOnGUI = new CalOnGUI();
         StartCoroutine(WaitLoading());
     }
 }
 void OnGUI()
 {
     if (Application.isPlaying == true)
     {
         if (patSysm.loadingComplete == false)
         {
             percentCount = Mathf.Lerp(percentCount, patSysm.loadingPercent, 5 * Time.deltaTime);
             GUI.BeginGroup(new Rect(calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width * (percentCount / 100), rect_progressbar.height)));
             if (textureProgressBar_Color == null)
             {
                 GUI.Box(new Rect(0, 0, calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).width, calOnGUI.SetGUI(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).height), "");
             }
             else
             {
                 GUI.DrawTexture(new Rect(0, 0, calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).width, calOnGUI.SetGUI(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).height), textureProgressBar_Color);
             }
             GUI.EndGroup();
             if (textureProgressBar_Frame != null)
             {
                 GUI.DrawTexture(new Rect(calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height)), textureProgressBar_Frame);
             }
             if (useShowPercent)
             {
                 GUI.Label(new Rect(calOnGUI.SetGUI(rect_percent_text.x, rect_percent_text.y, rect_percent_text.width, rect_percent_text.height)), percentCount.ToString("0") + "%");
             }
         }
     }
     else
     {
         if (previewProgressBar == true)
         {
             if (calOnGUI == null)
             {
                 calOnGUI = new CalOnGUI();
             }
             GUI.BeginGroup(new Rect(calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height)));
             if (textureProgressBar_Color == null)
             {
                 GUI.Box(new Rect(0, 0, calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).width, calOnGUI.SetGUI(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).height), "");
             }
             else
             {
                 GUI.DrawTexture(new Rect(0, 0, calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).width, calOnGUI.SetGUI(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).height), textureProgressBar_Color);
             }
             GUI.EndGroup();
             if (textureProgressBar_Frame != null)
             {
                 GUI.DrawTexture(new Rect(calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height)), textureProgressBar_Frame);
             }
             if (useShowPercent)
             {
                 GUI.Label(new Rect(calOnGUI.SetGUI(rect_percent_text.x, rect_percent_text.y, rect_percent_text.width, rect_percent_text.height)), "100%");
             }
         }
     }
 }
 void Start()
 {
     if (Application.isPlaying == true)
     {
         selectPlayer = PlayerPrefs.GetInt("SelectPlayer");
         instace      = this;
         calOnGUI     = GetComponent <CalOnGUI>();
         StartCoroutine(WaitLoading());
     }
 }
    void OnGUI()
    {
        if(Application.isPlaying == true){
            if(patSysm.loadingComplete == false){
                percentCount = Mathf.Lerp(percentCount, patSysm.loadingPercent, 5 * Time.deltaTime);
                GUI.BeginGroup(new Rect(calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width*(percentCount/100), rect_progressbar.height)));
                if(textureProgressBar_Color == null){
                    GUI.Box(new Rect(0,0, calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).width, calOnGUI.SetGUI(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).height),"");

                }else{
                    GUI.DrawTexture(new Rect(0,0, calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).width, calOnGUI.SetGUI(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).height),textureProgressBar_Color);

                }
                GUI.EndGroup();
                if(textureProgressBar_Frame != null){
                    GUI.DrawTexture(new Rect(calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height)), textureProgressBar_Frame);
                }
                if(useShowPercent)
                GUI.Label(new Rect(calOnGUI.SetGUI(rect_percent_text.x, rect_percent_text.y, rect_percent_text.width , rect_percent_text.height)),percentCount.ToString("0")+"%");
            }
        }else{
            if(previewProgressBar == true){
                if(calOnGUI == null){
                    calOnGUI = new CalOnGUI();
                }
                GUI.BeginGroup(new Rect(calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width , rect_progressbar.height)));
                if(textureProgressBar_Color == null){
                    GUI.Box(new Rect(0,0, calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).width, calOnGUI.SetGUI(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).height),"");

                }else{
                    GUI.DrawTexture(new Rect(0,0, calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).width, calOnGUI.SetGUI(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height).height),textureProgressBar_Color);

                }
                GUI.EndGroup();
                if(textureProgressBar_Frame != null){
                    GUI.DrawTexture(new Rect(calOnGUI.SetGUI_Left(rect_progressbar.x, rect_progressbar.y, rect_progressbar.width, rect_progressbar.height)), textureProgressBar_Frame);
                }
                if(useShowPercent)
                GUI.Label(new Rect(calOnGUI.SetGUI(rect_percent_text.x, rect_percent_text.y, rect_percent_text.width , rect_percent_text.height)),"100%");
            }
        }
    }
Example #6
0
    void Update()
    {
        //Set to preview GUI in editor
        if(Application.isPlaying == false){
            if(calOnGUI == null){
                calOnGUI = GetComponent<CalOnGUI> ();
            }
            for(int i = 0; i < itemStateSet.Count; i++){
                if(isPreview){
                    itemStateSet[i].guiTexture.enabled = true;
                    itemStateSet[i].guiText.enabled = true;
                    if(itemStateSet[i].itemType == Item.TypeItem.ItemJump){
                        ShowGUI(i, 1);
                    }

                    if(itemStateSet[i].itemType == Item.TypeItem.ItemMagnet){
                        ShowGUI(i, 1);
                    }

                    if(itemStateSet[i].itemType == Item.TypeItem.ItemMultiply){
                        ShowGUI(i, 1);
                    }

                    if(itemStateSet[i].itemType == Item.TypeItem.ItemSprint){
                        ShowGUI(i, 1);
                    }

                }else{
                    itemStateSet[i].guiTexture.enabled = false;
                    itemStateSet[i].guiText.enabled = false;
                }
            }

            for(int i = 0; i < menuButtonSet.Count; i++){
                if(isPreview){
                    menuButtonSet[i].guiTexture.enabled = true;
                    ShowGUIButton(i);

                }else{
                    menuButtonSet[i].guiTexture.enabled = false;
                }
            }

            for(int i = 0; i < scoreSet.Count; i++)
            {
                if(isPreview){
                    scoreSet[i].guiTexture.enabled = true;
                    ShowGUIScore(i);
                }else{
                    scoreSet[i].guiTexture.enabled = false;
                }
            }

        }else{
            if(PatternSystem.instance.loadingComplete == true){
                for(int i = 0; i < guiTextArr.Length; i++){
                    //guiText[i].pixelOffset = new Vector2(calOnGUI.SetGUI(positionSet[i].x, positionSet[i].y, positionSet[i].sizeX).x
                    //									, calOnGUI.SetGUI(positionSet[i].x, positionSet[i].y, positionSet[i].sizeX).y);

                    guiTextArr[i].enabled = true;
                    guiTextArr[i].pixelOffset = new Vector2(GUI_Calculate.RectWithScrren_WidthAndHeight_Sizeheight(new Vector2(positionSet[i].x, positionSet[i].y),
                                                                                                                new Vector2(positionSet[i].sizeX, positionSet[i].sizeY)).x,
                                                        GUI_Calculate.RectWithScrren_WidthAndHeight_Sizeheight(new Vector2(positionSet[i].x, positionSet[i].y),
                                                                                                                new Vector2(positionSet[i].sizeX, positionSet[i].sizeY)).y);
                    guiTextArr[i].fontSize = GUI_Calculate.FontSize((int)positionSet[i].sizeX);
                    if(positionSet[i].name == "Distance"){
                        guiTextArr[i].text = ""+(int)GameAttribute.gameAttribute.distance;
                    }else if(positionSet[i].name == "Coin"){
                        guiTextArr[i].text = ""+(int)GameAttribute.gameAttribute.coin;
                    }
                }

                //RectWithScrren_WidthAndHeight_Sizeheight

                for(int i = 0; i < scoreSet.Count; i++)
                {
                    scoreSet[i].guiTexture.enabled = true;
                    ShowGUIScore(i);

                }

                if(Controller.instace != null){
                for(int i = 0; i < itemStateSet.Count; i++){
                    if(itemStateSet[i].itemType == Item.TypeItem.ItemJump){
                        if(Controller.instace.timeJump > 0){
                            itemStateSet[i].guiTexture.enabled = true;
                            itemStateSet[i].guiText.enabled = true;
                            ShowGUI(i, Controller.instace.timeJump);
                        }else{
                            itemStateSet[i].guiTexture.enabled = false;
                            itemStateSet[i].guiText.enabled = false;
                        }
                    }

                    if(itemStateSet[i].itemType == Item.TypeItem.ItemMagnet){
                        if(Controller.instace.timeMagnet > 0){
                            itemStateSet[i].guiTexture.enabled = true;
                            itemStateSet[i].guiText.enabled = true;
                            ShowGUI(i, Controller.instace.timeMagnet);
                        }else{
                            itemStateSet[i].guiTexture.enabled = false;
                            itemStateSet[i].guiText.enabled = false;
                        }
                    }

                    if(itemStateSet[i].itemType == Item.TypeItem.ItemMultiply){
                        if(Controller.instace.timeMultiply > 0){
                            itemStateSet[i].guiTexture.enabled = true;
                            itemStateSet[i].guiText.enabled = true;
                            ShowGUI(i, Controller.instace.timeMultiply);
                        }else{
                            itemStateSet[i].guiTexture.enabled = false;
                            itemStateSet[i].guiText.enabled = false;
                        }
                    }

                    if(itemStateSet[i].itemType == Item.TypeItem.ItemSprint){
                        if(Controller.instace.timeSprint > 0){
                            itemStateSet[i].guiTexture.enabled = true;
                            itemStateSet[i].guiText.enabled = true;
                            ShowGUI(i, Controller.instace.timeSprint);
                        }else{
                            itemStateSet[i].guiTexture.enabled = false;
                            itemStateSet[i].guiText.enabled = false;
                        }
                    }
                }
                }

                for(int i = 0; i < menuButtonSet.Count; i++){
                    ShowGUIButton(i);
                    CheckTypeButtonActive(i);
                    if(menuButtonSet[i].guiTexture.HitTest(Input.mousePosition)){
                        if(Input.GetMouseButtonDown(0)){
                            menuButtonSet[i].guiTexture.texture = menuButtonSet[i].buttonActive;
                        }

                        if(Input.GetMouseButtonUp(0)){
                            menuButtonSet[i].guiTexture.texture = menuButtonSet[i].buttonNormal;
                            CheckTypeButtonAction(i);
                        }
                    }else{
                        menuButtonSet[i].guiTexture.texture = menuButtonSet[i].buttonNormal;
                    }
                }
            }else{
                for(int i = 0; i < guiTextArr.Length; i++){
                    guiTextArr[i].text = "";
                }
            }
        }
    }
Example #7
0
 void Start()
 {
     calOnGUI = GetComponent<CalOnGUI> ();
     instance = this;
 }
Example #8
0
    void Update()
    {
        //Set to preview GUI in editor
        if (Application.isPlaying == false)
        {
            if (calOnGUI == null && createGUI == false)
            {
                calOnGUI  = new CalOnGUI();
                createGUI = true;
            }
            for (int i = 0; i < itemStateSet.Count; i++)
            {
                if (isPreview)
                {
                    itemStateSet[i].guiTexture.enabled = true;
                    itemStateSet[i].guiText.enabled    = true;
                    if (itemStateSet[i].itemType == Item.TypeItem.ItemJump)
                    {
                        ShowGUI(i, 1);
                    }

                    if (itemStateSet[i].itemType == Item.TypeItem.ItemMagnet)
                    {
                        ShowGUI(i, 1);
                    }

                    if (itemStateSet[i].itemType == Item.TypeItem.ItemMultiply)
                    {
                        ShowGUI(i, 1);
                    }

                    if (itemStateSet[i].itemType == Item.TypeItem.ItemSprint)
                    {
                        ShowGUI(i, 1);
                    }
                }
                else
                {
                    itemStateSet[i].guiTexture.enabled = false;
                    itemStateSet[i].guiText.enabled    = false;
                }
            }

            for (int i = 0; i < menuButtonSet.Count; i++)
            {
                if (isPreview)
                {
                    menuButtonSet[i].guiTexture.enabled = true;
                    ShowGUIButton(i);
                }
                else
                {
                    menuButtonSet[i].guiTexture.enabled = false;
                }
            }

            for (int i = 0; i < scoreSet.Count; i++)
            {
                if (isPreview)
                {
                    scoreSet[i].guiTexture.enabled = true;
                    ShowGUIScore(i);
                }
                else
                {
                    scoreSet[i].guiTexture.enabled = false;
                }
            }
        }
        else
        {
            if (PatternSystem.instance.loadingComplete == true)
            {
                for (int i = 0; i < guiText.Length; i++)
                {
                    //guiText[i].pixelOffset = new Vector2(calOnGUI.SetGUI(positionSet[i].x, positionSet[i].y, positionSet[i].sizeX).x
                    //									, calOnGUI.SetGUI(positionSet[i].x, positionSet[i].y, positionSet[i].sizeX).y);

                    guiText[i].enabled = true;

                    /*
                     * guiText[i].pixelOffset = new Vector2(GUI_Calculate.RectWithScrren_WidthAndHeight_Sizeheight(new Vector2(positionSet[i].x, positionSet[i].y),
                     *                                                                                                                                                                                      new Vector2(positionSet[i].sizeX, positionSet[i].sizeY)).x,
                     *                                                                      GUI_Calculate.RectWithScrren_WidthAndHeight_Sizeheight(new Vector2(positionSet[i].x, positionSet[i].y),
                     *                                                                                                                                                                                      new Vector2(positionSet[i].sizeX, positionSet[i].sizeY)).y);
                     */
                    guiText[i].fontSize = GUI_Calculate.FontSize((int)positionSet[i].sizeX);
                    if (positionSet[i].name == "Distance")
                    {
                        guiText[i].text = "" + (int)GameAttribute.gameAttribute.distance;
                    }
                    else if (positionSet[i].name == "Coin")
                    {
                        guiText[i].text = "" + (int)GameAttribute.gameAttribute.coin;
                    }
                }

                //RectWithScrren_WidthAndHeight_Sizeheight

                for (int i = 0; i < scoreSet.Count; i++)
                {
                    scoreSet[i].guiTexture.enabled = true;
                    ShowGUIScore(i);
                }

                for (int i = 0; i < itemStateSet.Count; i++)
                {
                    if (itemStateSet[i].itemType == Item.TypeItem.ItemJump)
                    {
                        if (Controller.instace.timeJump > 0)
                        {
                            itemStateSet[i].guiTexture.enabled = true;
                            itemStateSet[i].guiText.enabled    = true;
                            ShowGUI(i, Controller.instace.timeJump);
                        }
                        else
                        {
                            itemStateSet[i].guiTexture.enabled = false;
                            itemStateSet[i].guiText.enabled    = false;
                        }
                    }

                    if (itemStateSet[i].itemType == Item.TypeItem.ItemMagnet)
                    {
                        if (Controller.instace.timeMagnet > 0)
                        {
                            itemStateSet[i].guiTexture.enabled = true;
                            itemStateSet[i].guiText.enabled    = true;
                            ShowGUI(i, Controller.instace.timeMagnet);
                        }
                        else
                        {
                            itemStateSet[i].guiTexture.enabled = false;
                            itemStateSet[i].guiText.enabled    = false;
                        }
                    }

                    if (itemStateSet[i].itemType == Item.TypeItem.ItemMultiply)
                    {
                        if (Controller.instace.timeMultiply > 0)
                        {
                            itemStateSet[i].guiTexture.enabled = true;
                            itemStateSet[i].guiText.enabled    = true;
                            ShowGUI(i, Controller.instace.timeMultiply);
                        }
                        else
                        {
                            itemStateSet[i].guiTexture.enabled = false;
                            itemStateSet[i].guiText.enabled    = false;
                        }
                    }

                    if (itemStateSet[i].itemType == Item.TypeItem.ItemSprint)
                    {
                        if (Controller.instace.timeSprint > 0)
                        {
                            itemStateSet[i].guiTexture.enabled = true;
                            itemStateSet[i].guiText.enabled    = true;
                            ShowGUI(i, Controller.instace.timeSprint);
                        }
                        else
                        {
                            itemStateSet[i].guiTexture.enabled = false;
                            itemStateSet[i].guiText.enabled    = false;
                        }
                    }
                }

                for (int i = 0; i < menuButtonSet.Count; i++)
                {
                    ShowGUIButton(i);
                    CheckTypeButtonActive(i);

                    /*
                     * if(menuButtonSet[i].guiTexture.HitTest(Input.mousePosition)){
                     *      if(Input.GetMouseButtonDown(0)){
                     *              menuButtonSet[i].guiTexture.texture = menuButtonSet[i].buttonActive;
                     *      }
                     *
                     *      if(Input.GetMouseButtonUp(0)){
                     *              //menuButtonSet[i].guiTexture.texture = menuButtonSet[i].buttonNormal;
                     *              CheckTypeButtonAction(i);
                     *      }
                     * }else{
                     *      //menuButtonSet[i].guiTexture.texture = menuButtonSet[i].buttonNormal;
                     * }*/
                }
            }
            else
            {
                for (int i = 0; i < guiText.Length; i++)
                {
                    guiText[i].text = "";
                }
            }
        }
    }
Example #9
0
 void Start()
 {
     calOnGUI = new CalOnGUI();
     instance = this;
 }
Example #10
0
 void Start()
 {
     calOnGUI = GetComponent <CalOnGUI> ();
     instance = this;
 }