示例#1
0
    void LoginFacebook()
    {
        // Disable interaction
        SetInteractable(false);

        // Show loading
        SetShowLoading(true);

        // Login Facebook
        FBManager.LogIn((error) =>
        {
            if (error != null)
            {
                Log.Error(error);
            }
            else
            {
                // Update Facebook
                FBManager.Instance.OnUpdate();
            }

            // Hide loading
            SetShowLoading(false);

            // Set sprite
            loginButton.SetSprite(FB.IsLoggedIn ? logOut : logIn);

            // Update Connect button
            UpdateConnectFacebook();

            // Enable interaction
            SetInteractable(true);
        });
    }
示例#2
0
 void Awake()
 {
     DontDestroyOnLoad(this.gameObject);
     _instance       = this;
     AppLinkUrl      = "https://fb.me/647371218760374";    // Create on https://developers.facebook.com/quickstarts/641056969391799/?platform=app-links-host
     ImageAppLinkUrl = "https://i.imgsafe.org/cdc3d38b50.png";
 }
示例#3
0
	// Awake function from Unity's MonoBehavior
	void Awake ()
	{
		if (FBManager.Instance == null) {
			Instance = this;
		}

		Init ();
	}
示例#4
0
 private void SingletonStart()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(this.gameObject);
     }
 }
示例#5
0
    public void LoadFbEvents(FBManager _fbHolder)
    {
        fbHolder = _fbHolder;

        //DialogLoggedIn = _fbHolder.DialogLoggedIn;
        // DialogLoggedOut = fbHolder.DialogLoggedOut.GetComponent<GameObject>();
        //  DialogProfilePic = fbHolder.DialogProfilePic.GetComponent<GameObject>();
        // scoreEntryPanel = fbHolder.scoreEntryPanel.GetComponent<GameObject>();
        //  scoreScrollList = fbHolder.scoreScrollList.GetComponent<GameObject>();
        //leaderboard = fbHolder.leaderboard.GetComponent<GameObject>();
    }
示例#6
0
    void Start()
    {
        settingsDown    = false;
        settingsAnim    = settings.GetComponent <Animator>();
        shopUp          = false;
        shopAnim        = shopMenu.GetComponent <Animator>();
        facebookManager = GetComponent <FBManager>();
        canvasPanelAnim = canvasPanel.GetComponent <Animator>();

        shopContainerY       = shopContainer.transform.position.y;
        shopContainerPositon = shopContainer.transform.position;
        audioOn = true;
    }
示例#7
0
    void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
            return;
        }

        instance = this;

        InitFacebook();

        DontDestroyOnLoad(gameObject);
    }
    public void Construct(string id, string name)
    {
        // Set name
        this.name.text = name;

        // Get avatar
        FBManager.GetAvatar(id, (sprite) => {
            // Set avatar
            if (avatar != null && sprite != null)
            {
                avatar.sprite = sprite;
            }
        });
    }
    private void Start()
    {
        menuManager = GetComponent <MenuManager>();
#if UNITY_ADS
        unityAds = GetComponent <PUPUnityAds>();
#endif
        facebookManager = GetComponent <FBManager>();
        //purchaser = GetComponent<Purchaser>();
        youRecieveAnim   = youRecieveText.GetComponent <Animator>();
        recieveCoinsAnim = revieceCoinsText.GetComponent <Animator>();

        audioSource = GetComponent <AudioSource>();

        backgroundMusicAudio = backgroundMusic.GetComponent <AudioSource>();
    }
示例#10
0
    public void ConnectFacebook()
    {
        // Play sound
        SoundManager.PlayButtonClick();

        // Check if offline
        if (!Helper.IsOnline())
        {
            // Hide sunlight
            sunlight.Hide();

            Manager.Instance.ShowMessage(Settings.NoInternetConnection, () => {
                // Show sunlight
                sunlight.Show();
            });

            return;
        }

        // Disable interaction
        SetInteractable(false);

        // Show loading
        SetShowLoading(true);

        // Login Facebook
        FBManager.LogIn((error) =>
        {
            if (error != null)
            {
                Log.Error(error);
            }
            else
            {
                // Update Facebook
                FBManager.Instance.OnUpdate();
            }

            // Hide loading
            SetShowLoading(false);

            // Update Connect button
            UpdateConnectFacebook();

            // Enable interaction
            SetInteractable(true);
        });
    }
示例#11
0
    private static void OnInitComplete()
    {
        FBManager.Status       = "Success - Check log for details";
        FBManager.LastResponse = "Success Response: OnInitComplete Called\n";
        string text = string.Format("OnInitCompleteCalled IsLoggedIn='{0}' IsInitialized='{1}'", FB.IsLoggedIn, FB.IsInitialized);

        if (AccessToken.CurrentAccessToken != null)
        {
        }
        if (FB.IsInitialized)
        {
            MonoBehaviour.print("FB.IsInitialized");
            FBManager.CallFBLogin();
            FBManager.Status = "Login called";
        }
    }
示例#12
0
 public static void StartAuth()
 {
     if (GameData.gVK)
     {
         if (Time.time < BaseData.AuthTime + 1f)
         {
             return;
         }
         Application.ExternalCall("get_auth", new object[]
         {
             string.Empty
         });
         BaseData.AuthTime = Time.time;
     }
     if (GameData.gFB)
     {
         if (Time.time < BaseData.AuthTime + 1f)
         {
             return;
         }
         FBManager.StartAuth();
         BaseData.AuthTime = Time.time;
     }
 }
示例#13
0
文件: FBManager.cs 项目: patpatan/D9
 void Awake()
 {
     DontDestroyOnLoad(this.gameObject);
     _instance = this;
 }
示例#14
0
    private void OnGUI()
    {
        Rect r = new Rect((float)Screen.width / 2f - GUIM.YRES(160f), (float)Screen.height / 2f - GUIM.YRES(30f), GUIM.YRES(400f), GUIM.YRES(80f));

        if (GameData.gSteam)
        {
            if (!Steam.active)
            {
                GUIM.DrawBox(r, Main.tBlack);
                GUIM.DrawText(r, Lang.Get("_STEAM_NOT_LAUNCHED"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, true);
                return;
            }
            if (!Steam.logged)
            {
                GUIM.DrawBox(r, Main.tBlack);
                GUIM.DrawText(r, Lang.Get("_STEAM_NOT_LOGGEDON"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, true);
                return;
            }
        }
        if (!ContentLoader_.proceed)
        {
            UIManager.SetLoadingActive(true);
            return;
        }
        UIManager.SetLoadingActive(false);
        if (BaseData.banCost != string.Empty)
        {
            GUIM.DrawBox(r, Main.tBlack);
            Rect   r2  = new Rect(r.x, r.y, r.width, r.height - GUIM.YRES(36f));
            string str = "$" + BaseData.banCost;
            if (GameData.gVK)
            {
                str = BaseData.banCost + " г.";
            }
            if (GameData.gFB)
            {
                int num = Convert.ToInt32(BaseData.banCost);
                str = string.Format("{0:C}", (float)num * 0.12f);
            }
            GUIM.DrawText(r2, Lang.Get("_YOU_BANNED!_UNBAN_COST") + " - " + str, TextAnchor.MiddleCenter, BaseColor.White, 1, 16, true);
            Rect r3 = new Rect(r.x + GUIM.YRES(84f), r.y + GUIM.YRES(44f), GUIM.YRES(100f), GUIM.YRES(22f));
            if (GameData.gSocial)
            {
                r3 = new Rect(r.x + GUIM.YRES(150f), r.y + GUIM.YRES(44f), GUIM.YRES(100f), GUIM.YRES(22f));
            }
            if (Main.inbuySteam || Main.inbuySocial)
            {
                GUIM.Button(r3, BaseColor.Gray, Lang.Get("_UNBAN"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, true);
            }
            else
            {
                if (GameData.gSteam && GUIM.Button(r3, BaseColor.Green, Lang.Get("_UNBAN"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, true))
                {
                    WebHandler.get_buy("&itemid=10000");
                    Main.inbuySteam = true;
                }
                if (GameData.gVK && GUIM.Button(r3, BaseColor.Green, Lang.Get("_UNBAN"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, true))
                {
                    Main.inbuySocial = true;
                    Application.ExternalCall("order", new object[]
                    {
                        "item10000"
                    });
                }
                if (GameData.gFB && GUIM.Button(r3, BaseColor.Green, Lang.Get("_UNBAN"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, true))
                {
                    Main.inbuySocial = true;
                    FBManager.BuyUnbun(Convert.ToInt32(BaseData.banCost));
                }
            }
            if (GameData.gSteam)
            {
                Rect r4 = new Rect(r.x + GUIM.YRES(216f), r.y + GUIM.YRES(44f), GUIM.YRES(100f), GUIM.YRES(22f));
                if (GUIM.Button(r4, BaseColor.Red, Lang.Get("_EXIT"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, true))
                {
                    Application.Quit();
                }
            }
            return;
        }
        if (!Client.actualVersion)
        {
            GUIM.DrawBox(r, Main.tBlack);
            Rect r5 = new Rect(r.x, r.y, r.width, r.height - GUIM.YRES(36f));
            if (GameData.gSteam)
            {
                GUIM.DrawText(r5, Lang.Get("_UPDATE_VERSION"), TextAnchor.MiddleCenter, BaseColor.White, 1, 16, true);
                Rect r6 = new Rect(r.x + GUIM.YRES(150f), r.y + GUIM.YRES(44f), GUIM.YRES(100f), GUIM.YRES(22f));
                if (GUIM.Button(r6, BaseColor.Red, Lang.Get("_EXIT"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, true))
                {
                    Application.Quit();
                }
            }
            if (GameData.gSocial)
            {
                GUIM.DrawText(r, Lang.Get("_UPDATE_VERSION"), TextAnchor.MiddleCenter, BaseColor.White, 1, 16, true);
            }
            return;
        }
        if (!BaseData.Auth)
        {
            GUIM.DrawBox(r, Main.tBlack);
            GUIM.DrawText(r, Lang.Get("_AUTHORIZATION"), TextAnchor.MiddleCenter, BaseColor.White, 1, 12, true);
            return;
        }
        if (Main.tVig)
        {
            GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), Main.tVig);
        }
        TopBar.Draw();
        BottomBar.Draw();
        Profile.Draw();
        MenuPlayer.Draw();
        MenuGold.Draw();
        MenuServers.Draw();
        MenuShop.Draw();
        MenuOptions.Draw();
        MenuInventory.Draw();
        MenuPreview.Draw();
        if (GameData.gSteam)
        {
            MenuFriends.Draw();
        }
    }
示例#15
0
 void Awake()
 {
     GetComponent <CanvasScaler>().referenceResolution = new Vector2(1080, 1920);
     fbManagerScript = GameObject.Find("FBManager").GetComponent <FBManager>();
     ballPanel.GetComponent <RectTransform>().sizeDelta = new Vector2(ballPanelWidth, ballPanelHeight);
 }
示例#16
0
 public static void Draw()
 {
     if (!MenuGold.show)
     {
         return;
     }
     GUIM.DrawBox(MenuGold.rBack, MenuGold.tBlack);
     GUI.DrawTexture(MenuGold.rBackName, MenuGold.tOrange);
     GUIM.DrawText(MenuGold.rBackName, Lang.Get("_ADD_GOLD"), TextAnchor.MiddleCenter, BaseColor.White, 1, 16, false);
     if (GameData.gVK)
     {
         if (MenuGold.DrawPrice(new Rect(MenuGold.rBackName.x, MenuGold.rBackName.y + GUIM.YRES(128f) + GUIM.YRES(44f) * 0f, MenuGold.rBackName.width, GUIM.YRES(36f)), "1", "8", string.Empty))
         {
             Application.ExternalCall("order", new object[]
             {
                 "item0"
             });
         }
         if (MenuGold.DrawPrice(new Rect(MenuGold.rBackName.x, MenuGold.rBackName.y + GUIM.YRES(128f) + GUIM.YRES(44f) * 1f, MenuGold.rBackName.width, GUIM.YRES(36f)), "5", "40", string.Empty))
         {
             Application.ExternalCall("order", new object[]
             {
                 "item1"
             });
         }
         if (MenuGold.DrawPrice(new Rect(MenuGold.rBackName.x, MenuGold.rBackName.y + GUIM.YRES(128f) + GUIM.YRES(44f) * 2f, MenuGold.rBackName.width, GUIM.YRES(36f)), "10", "80", string.Empty))
         {
             Application.ExternalCall("order", new object[]
             {
                 "item2"
             });
         }
         if (MenuGold.DrawPrice(new Rect(MenuGold.rBackName.x, MenuGold.rBackName.y + GUIM.YRES(128f) + GUIM.YRES(44f) * 3f, MenuGold.rBackName.width, GUIM.YRES(36f)), "50", "400", "+40"))
         {
             Application.ExternalCall("order", new object[]
             {
                 "item3"
             });
         }
         if (MenuGold.DrawPrice(new Rect(MenuGold.rBackName.x, MenuGold.rBackName.y + GUIM.YRES(128f) + GUIM.YRES(44f) * 4f, MenuGold.rBackName.width, GUIM.YRES(36f)), "100", "800", "+100"))
         {
             Application.ExternalCall("order", new object[]
             {
                 "item4"
             });
         }
         if (MenuGold.DrawPrice(new Rect(MenuGold.rBackName.x, MenuGold.rBackName.y + GUIM.YRES(128f) + GUIM.YRES(44f) * 5f, MenuGold.rBackName.width, GUIM.YRES(36f)), "200", "1600", "+240"))
         {
             Application.ExternalCall("order", new object[]
             {
                 "item5"
             });
         }
     }
     if (GameData.gFB)
     {
         if (MenuGold.DrawPrice(new Rect(MenuGold.rBackName.x, MenuGold.rBackName.y + GUIM.YRES(128f) + GUIM.YRES(44f) * 0f, MenuGold.rBackName.width, GUIM.YRES(36f)), "$0.16", "8", string.Empty))
         {
             FBManager.BuyCoins(8);
         }
         if (MenuGold.DrawPrice(new Rect(MenuGold.rBackName.x, MenuGold.rBackName.y + GUIM.YRES(128f) + GUIM.YRES(44f) * 1f, MenuGold.rBackName.width, GUIM.YRES(36f)), "$0.80", "40", string.Empty))
         {
             FBManager.BuyCoins(40);
         }
         if (MenuGold.DrawPrice(new Rect(MenuGold.rBackName.x, MenuGold.rBackName.y + GUIM.YRES(128f) + GUIM.YRES(44f) * 2f, MenuGold.rBackName.width, GUIM.YRES(36f)), "$1.60", "80", string.Empty))
         {
             FBManager.BuyCoins(80);
         }
         if (MenuGold.DrawPrice(new Rect(MenuGold.rBackName.x, MenuGold.rBackName.y + GUIM.YRES(128f) + GUIM.YRES(44f) * 3f, MenuGold.rBackName.width, GUIM.YRES(36f)), "$8.00", "400", "+40"))
         {
             FBManager.BuyCoins(400);
         }
         if (MenuGold.DrawPrice(new Rect(MenuGold.rBackName.x, MenuGold.rBackName.y + GUIM.YRES(128f) + GUIM.YRES(44f) * 4f, MenuGold.rBackName.width, GUIM.YRES(36f)), "$16.00", "800", "+100"))
         {
             FBManager.BuyCoins(800);
         }
         if (MenuGold.DrawPrice(new Rect(MenuGold.rBackName.x, MenuGold.rBackName.y + GUIM.YRES(128f) + GUIM.YRES(44f) * 5f, MenuGold.rBackName.width, GUIM.YRES(36f)), "$32.00", "1600", "+240"))
         {
             FBManager.BuyCoins(1600);
         }
     }
 }
示例#17
0
 void Awake()
 {
     DontDestroyOnLoad(this.gameObject);
     _instance  = this;
     IsLoggedIn = true;
 }