示例#1
0
    /// <summary>
    /// Displays the welcome screen of the game.
    /// </summary>
    void welcomeScreen()
    {
        Color backupColor = GUI.color;
        float vertGap     = 80f;

        //drawing background, just using a white pixel here
        GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), tBackground);
        GUI.DrawTexture(new Rect(0, 0, Screen.width, timesH(240f)), tShed, ScaleMode.StretchToFill, true);


        float rowsTop    = 300.0f;
        float rowsHeight = 120.0f;

        GUI.DrawTexture(new Rect(timesW(65.0f), timesH(rowsTop + 10f), timesW(516.0f), timesH(102.0f)), tBGBar, ScaleMode.StretchToFill, true);

        if (SoomlaProfile.IsLoggedIn(targetProvider))
        {
            GUI.skin.button.normal.background = tShare;
            GUI.skin.button.hover.background  = tShare;
            GUI.skin.button.active.background = tSharePress;
            if (GUI.Button(new Rect(timesW(50.0f), timesH(rowsTop), timesW(212.0f), timesH(120.0f)), ""))
            {
                SoomlaProfile.UpdateStatus(targetProvider, "I LOVE SOOMLA !  http://www.soom.la", null, exampleReward);
            }
        }
        else
        {
            GUI.DrawTexture(new Rect(timesW(50.0f), timesH(rowsTop), timesW(212.0f), timesH(120.0f)), tShareDisable,
                            ScaleMode.StretchToFill, true);
        }

        GUI.color                = Color.black;
        GUI.skin.label.font      = fgoodDog;
        GUI.skin.label.fontSize  = 30;
        GUI.skin.label.alignment = TextAnchor.MiddleCenter;
        GUI.Label(new Rect(timesW(270.0f), timesH(rowsTop), timesW(516.0f - 212.0f), timesH(120.0f)), "I Love SOOMLA!");
        GUI.color = backupColor;


        rowsTop += vertGap + rowsHeight;


        GUI.DrawTexture(new Rect(timesW(65.0f), timesH(rowsTop + 10f), timesW(516.0f), timesH(102.0f)), tBGBar, ScaleMode.StretchToFill, true);

        if (SoomlaProfile.IsLoggedIn(targetProvider))
        {
            GUI.skin.button.normal.background = tShareStory;
            GUI.skin.button.hover.background  = tShareStory;
            GUI.skin.button.active.background = tShareStoryPress;
            if (GUI.Button(new Rect(timesW(50.0f), timesH(rowsTop), timesW(212.0f), timesH(120.0f)), ""))
            {
                SoomlaProfile.UpdateStory(targetProvider,
                                          "The story of SOOMBOT (Profile Test App)",
                                          "The story of SOOMBOT (Profile Test App)",
                                          "SOOMBOT Story",
                                          "DESCRIPTION",
                                          "http://about.soom.la/soombots",
                                          "http://about.soom.la/wp-content/uploads/2014/05/330x268-spockbot.png",
                                          null,
                                          exampleReward);
            }
        }
        else
        {
            GUI.DrawTexture(new Rect(timesW(50.0f), timesH(rowsTop), timesW(212.0f), timesH(120.0f)), tShareStoryDisable,
                            ScaleMode.StretchToFill, true);
        }

        GUI.color                = Color.black;
        GUI.skin.label.font      = fgoodDog;
        GUI.skin.label.fontSize  = 25;
        GUI.skin.label.alignment = TextAnchor.MiddleCenter;
        GUI.Label(new Rect(timesW(270.0f), timesH(rowsTop), timesW(516.0f - 212.0f), timesH(120.0f)), "Full story of The SOOMBOT!");
        GUI.color = backupColor;



        rowsTop += vertGap + rowsHeight;


        GUI.DrawTexture(new Rect(timesW(65.0f), timesH(rowsTop + 10f), timesW(516.0f), timesH(102.0f)), tBGBar, ScaleMode.StretchToFill, true);

        if (SoomlaProfile.IsLoggedIn(targetProvider))
        {
            GUI.skin.button.normal.background = tUpload;
            GUI.skin.button.hover.background  = tUpload;
            GUI.skin.button.active.background = tUploadPress;
            if (GUI.Button(new Rect(timesW(50.0f), timesH(rowsTop), timesW(212.0f), timesH(120.0f)), ""))
            {
//				string fileName = "soom.jpg";
//				string path = "";
//
//				#if UNITY_IOS
//				path = Application.dataPath + "/Raw/" + fileName;
//				#elif UNITY_ANDROID
//				path = "jar:file://" + Application.dataPath + "!/assets/" + fileName;
//				#endif
//
//				byte[] bytes = File.ReadAllBytes(path);
//				SoomlaProfile.UploadImage(targetProvider, "Awesome Test App of SOOMLA Profile!", fileName, bytes, 10, null, exampleReward);
                SoomlaProfile.UploadCurrentScreenShot(this, targetProvider, "Awesome Test App of SOOMLA Profile!", "This a screenshot of the current state of SOOMLA's test app on my computer.", null);
            }
        }
        else
        {
            GUI.DrawTexture(new Rect(timesW(50.0f), timesH(rowsTop), timesW(212.0f), timesH(120.0f)), tUploadDisable,
                            ScaleMode.StretchToFill, true);
        }

        GUI.color                = Color.black;
        GUI.skin.label.font      = fgoodDog;
        GUI.skin.label.fontSize  = 28;
        GUI.skin.label.alignment = TextAnchor.MiddleCenter;
        GUI.Label(new Rect(timesW(270.0f), timesH(rowsTop), timesW(516.0f - 212.0f), timesH(120.0f)), "Current Screenshot");
        GUI.color = backupColor;



        if (SoomlaProfile.IsLoggedIn(targetProvider))
        {
            GUI.skin.button.normal.background = tLogout;
            GUI.skin.button.hover.background  = tLogout;
            GUI.skin.button.active.background = tLogoutPress;
            if (GUI.Button(new Rect(timesW(20.0f), timesH(950f), timesW(598.0f), timesH(141.0f)), ""))
            {
                SoomlaProfile.Logout(targetProvider);
            }
        }
        else if (isInit)
        {
            GUI.skin.button.normal.background = tConnect;
            GUI.skin.button.hover.background  = tConnect;
            GUI.skin.button.active.background = tConnectPress;
            if (GUI.Button(new Rect(timesW(20.0f), timesH(950f), timesW(598.0f), timesH(141.0f)), ""))
            {
                //SoomlaProfile.GetLeaderboards(Provider.GAME_CENTER);
                SoomlaProfile.Login(targetProvider, null, exampleReward);
            }
        }
    }