示例#1
0
 public void GameCenterLogin()
 {
     SoomlaProfile.Login(
         Provider.GAME_CENTER                        // Social Provider
         //  new BadgeReward("loggedIn", "Logged In!") // Reward
         );
 }
示例#2
0
 public void FacebookLogin()
 {
     SoomlaProfile.Login(
         Provider.FACEBOOK                       // Social Provider
                                                 //  new BadgeReward("loggedIn", "Logged In!") // Reward
         );
 }
示例#3
0
 public void TwitterLogin()
 {
     SoomlaProfile.Login(
         Provider.TWITTER                        // Social Provider
                                                 //  new BadgeReward("loggedIn", "Logged In!") // Reward
         );
 }
    // Update is called once per frame
    void OnGUI()
    {
        if (GUILayout.Button("Login G+", GUILayout.MinWidth(200), GUILayout.MinHeight(100)))
        {
            SoomlaProfile.Login(Provider.GOOGLE, "", null);
        }

        if (GUILayout.Button("Logout G+", GUILayout.MinWidth(200), GUILayout.MinHeight(100)))
        {
            SoomlaProfile.Logout(Provider.GOOGLE);
        }

        if (GUILayout.Button("Login Twitter", GUILayout.MinWidth(200), GUILayout.MinHeight(100)))
        {
            SoomlaProfile.Login(Provider.TWITTER, "", null);
        }

        if (GUILayout.Button("Logout Twitter", GUILayout.MinWidth(200), GUILayout.MinHeight(100)))
        {
            SoomlaProfile.Logout(Provider.TWITTER);
        }

        if (GUILayout.Button("Login Facebook", GUILayout.MinWidth(200), GUILayout.MinHeight(100)))
        {
            SoomlaProfile.Login(Provider.FACEBOOK, "", null);
        }

        if (GUILayout.Button("Logout Facebook", GUILayout.MinWidth(200), GUILayout.MinHeight(100)))
        {
            SoomlaProfile.Logout(Provider.FACEBOOK);
        }
    }
 public void LogInOrLogOutTwitter()
 {
     if (SoomlaProfile.IsLoggedIn(Provider.TWITTER))
     {
         SoomlaProfile.Logout(Provider.TWITTER);
     }
     else
     {
         SoomlaProfile.Login(Provider.TWITTER);
     }
 }
示例#6
0
 //intenta logear a facebook mediante soomla
 public void tryLoginFB()
 {
     if (!isloggedFB())
     {
         SoomlaProfile.Login(Provider.FACEBOOK);
     }
     else
     {
         Debug.LogWarning("Ya esta logeado en FB");
     }
 }
示例#7
0
 // Provide form so user can login in to Twitter
 public void twitterLogin()
 {
     if (!SoomlaProfile.IsLoggedIn(Provider.TWITTER))
     {
         SoomlaProfile.Login(Provider.TWITTER, "twitter");
     }
     else
     {
         // If the user is already logged in and presses the button then post to twitter (auto-login scenario)
         postToTwitter();
     }
 }
示例#8
0
 // Provide form so user can login in to Facebook
 public void FBLogin()
 {
     if (!SoomlaProfile.IsLoggedIn(Provider.FACEBOOK))
     {
         SoomlaProfile.Login(Provider.FACEBOOK, "facebook");
     }
     else
     {
         // If the user is already logged in and presses the button then post to facebook (auto-login scenario)
         postToWall();
     }
 }
示例#9
0
 public void UpdateTwitterStory()
 {
     Debug.Log("Share button clicked. Login status: " + SoomlaProfile.IsLoggedIn(Provider.TWITTER));
     if (!SoomlaProfile.IsLoggedIn(Provider.TWITTER))
     {
         SoomlaProfile.Login(Provider.TWITTER);
         ProfileEvents.OnLoginFinished += (UserProfile userProfile, bool autologin, string payload) => {
             //Your code to execute here
             Debug.Log("onloginfinished Logged into " + userProfile.Provider + " username: "******"", null);
     CloseSharePopup();
 }
 public void LogInToFacebook()
 {
     SoomlaProfile.Login(Provider.FACEBOOK);
 }
示例#11
0
 public void LoginFB()
 {
     SoomlaProfile.Login(Provider.FACEBOOK);
 }
示例#12
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);
            }
        }
    }
示例#13
0
 /// <summary>
 /// Logs in to Twitter.
 /// </summary>
 public void LoginToTwitter()
 {
     SoomlaProfile.Login(Provider.TWITTER);
 }
        /// <summary>
        /// Display the goods screen of the game's store.
        /// </summary>
        void goodsScreen()
        {
            //white background
            GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), tWhitePixel);
            Color      backupColor     = GUI.color;
            TextAnchor backupAlignment = GUI.skin.label.alignment;
            Font       backupFont      = GUI.skin.label.font;

            GUI.color = Color.red;
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUI.Label(new Rect(10, 10, Screen.width - 10, Screen.height - 10), "SOOMLA Example Store");
            GUI.color = Color.black;
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUI.Label(new Rect(10, 10, Screen.width - 40, Screen.height), "" + StoreInventory.GetItemBalance(StoreInfo.Currencies[0].ItemId));
            GUI.skin.label.alignment = TextAnchor.MiddleCenter;
            GUI.skin.label.font      = fTitle;
            GUI.Label(new Rect(0, Screen.height / 8f, Screen.width, Screen.height / 8f), "Virtual Goods");

            if (GUI.Button(new Rect(10, 30, Screen.width - 40, 20), "Login"))
            {
                SoomlaProfile.Login(Provider.GOOGLE, "", null);
            }

            GUI.color = backupColor;
            GUI.DrawTexture(new Rect(Screen.width - 30, 10, 30, 30), tMuffins);
            float productSize = Screen.width * 0.30f;
            float totalHeight = StoreInfo.Goods.Count * productSize;

            //Here we start a scrollView, the first rectangle is the position of the scrollView on the screen,
            //the second rectangle is the size of the panel inside the scrollView.
            //All rectangles after this point are relative to the position of the scrollView.
            goodsScrollPosition = GUI.BeginScrollView(new Rect(0, Screen.height * 2f / 8f, Screen.width, Screen.height * 5f / 8f), goodsScrollPosition, new Rect(0, 0, Screen.width, totalHeight));
            float y = 0;

            foreach (VirtualGood vg in StoreInfo.Goods)
            {
                GUI.color = backupColor;
                if (GUI.Button(new Rect(0, y, Screen.width, productSize), "") && !isDragging)
                {
                    Debug.Log("SOOMLA/UNITY wants to buy: " + vg.Name);
                    try {
                        StoreInventory.BuyItem(vg.ItemId);
                    } catch (Exception e) {
                        Debug.Log("SOOMLA/UNITY " + e.Message);
                    }
                }
                GUI.DrawTexture(new Rect(0, y, Screen.width, productSize), tWhitePixel);
                //We draw a button so we can detect a touch and then draw an image on top of it.
                //TODO
                //Resources.Load(path) The path is the relative path starting from the Resources folder.
                //Make sure the images used for UI, have the textureType GUI. You can change this in the Unity editor.
                GUI.color = backupColor;
                GUI.DrawTexture(new Rect(0 + productSize / 8f, y + productSize / 8f, productSize * 6f / 8f, productSize * 6f / 8f), itemsTextures[vg.ItemId]);
                GUI.color                = Color.black;
                GUI.skin.label.font      = fName;
                GUI.skin.label.alignment = TextAnchor.UpperLeft;
                GUI.Label(new Rect(productSize, y, Screen.width, productSize / 3f), vg.Name);
                GUI.skin.label.font = fDesc;
                GUI.Label(new Rect(productSize + 10f, y + productSize / 3f, Screen.width - productSize - 15f, productSize / 3f), vg.Description);
                //set price
                if (vg.PurchaseType is PurchaseWithVirtualItem)
                {
                    GUI.Label(new Rect(Screen.width / 2f, y + productSize * 2 / 3f, Screen.width, productSize / 3f), "price:" + ((PurchaseWithVirtualItem)vg.PurchaseType).Amount);
                }
                else
                {
                    GUI.Label(new Rect(Screen.width / 2f, y + productSize * 2 / 3f, Screen.width, productSize / 3f), "price:$ " + ((PurchaseWithMarket)vg.PurchaseType).MarketItem.Price.ToString("0.00"));
                }
                GUI.Label(new Rect(Screen.width * 3 / 4f, y + productSize * 2 / 3f, Screen.width, productSize / 3f), "Balance:" + StoreInventory.GetItemBalance(vg.ItemId));
                GUI.skin.label.alignment = TextAnchor.UpperRight;
                GUI.skin.label.font      = fBuy;
                GUI.Label(new Rect(0, y, Screen.width - 10, productSize), "Click to buy");
                GUI.color = Color.grey;
                GUI.DrawTexture(new Rect(0, y + productSize - 1, Screen.width, 1), tWhitePixel);
                y += productSize;
            }
            GUI.EndScrollView();
            //We have just ended the scroll view this means that all the positions are relative top-left corner again.
            GUI.skin.label.alignment = backupAlignment;
            GUI.color           = backupColor;
            GUI.skin.label.font = backupFont;

            float height       = Screen.height / 8f;
            float borderSize   = height / 8f;
            float buttonHeight = height - 2 * borderSize;
            float width        = buttonHeight * 180 / 95;

            if (GUI.Button(new Rect(Screen.width * 2f / 7f - width / 2f, Screen.height * 7f / 8f + borderSize, width, buttonHeight), "back"))
            {
                guiState = GUIState.WELCOME;
#if UNITY_ANDROID && !UNITY_EDITOR
                SoomlaStore.StopIabServiceInBg();
#endif
            }
            GUI.DrawTexture(new Rect(Screen.width * 2f / 7f - width / 2f, Screen.height * 7f / 8f + borderSize, width, buttonHeight), tBack);
            width = buttonHeight * 227 / 94;
            if (GUI.Button(new Rect(Screen.width * 5f / 7f - width / 2f, Screen.height * 7f / 8f + borderSize, width, buttonHeight), "back"))
            {
                guiState = GUIState.PRODUCTS;
            }
            GUI.DrawTexture(new Rect(Screen.width * 5f / 7f - width / 2f, Screen.height * 7f / 8f + borderSize, width, buttonHeight), tGetMore);
        }