void UpdateAccountUI() { Fb.GetFriends(10, result => { Debug.Log($"friends count: {result.Users.Count}"); }, null); if (Fb.IsLoggedIn) { if (s_CurrentUser != null) { SetUserInfoUI(s_CurrentUser); } else { Fb.GetLoggedInUserInfo((result) => { if (result.IsSucceeded) { SetUserInfoUI(result.User); Debug.Log("result.User.Id: " + result.User.Id); Debug.Log("result.User.Name: " + result.User.Name); Debug.Log("result.User.FirstName: " + result.User.FirstName); Debug.Log("result.User.LastName: " + result.User.LastName); Debug.Log("result.User.Location: " + result.User.Location); Debug.Log("result.User.PictureUrl: " + result.User.PictureUrl); Debug.Log("result.User.ProfileUrl: " + result.User.ProfileUrl); Debug.Log("result.User.AgeRange: " + result.User.AgeRange); Debug.Log("result.User.Birthday: " + result.User.Birthday); Debug.Log("result.User.Gender: " + result.User.Gender); Debug.Log("result.User.AgeRange: " + result.User.AgeRange); Debug.Log("result.RawResult: " + result.RawResult); s_CurrentUser = result.User; } else { Debug.Log("Failed to load user Info: " + result.Error); } }); } } else { m_Connect.GetComponentInChildren <Text>().text = "Sing in"; m_UserName.text = "Signed out"; m_UserMail.text = "Signed out"; m_UserAvatar.texture = null; } }
void SignInFlow() { Fb.LogInWithPublishPermissions((result) => { if (result.IsSucceeded) { Debug.Log("Login Succeeded"); UpdateAccountUI(); } else { Debug.Log("Failed to login: " + result.Error); } }); }
//Make sure that this method will be called only once per app session void Start() { //This can be done via editor menu FbSettings.SetAppId("1605471223039154"); //This can also be done via the settings //We need email scope to be able to get user email FbSettings.Permissions.Clear(); if (!FbSettings.Permissions.Contains(FbPermissions.email)) { FbSettings.Permissions.Add(FbPermissions.email); } if (!FbSettings.Permissions.Contains(FbPermissions.user_location)) { FbSettings.Permissions.Add(FbPermissions.user_location); } if (!FbSettings.Permissions.Contains(FbPermissions.user_age_range)) { FbSettings.Permissions.Add(FbPermissions.user_age_range); } m_Connect.interactable = false; Fb.Init(() => { Debug.Log("Init Completed"); m_Connect.interactable = true; UpdateAccountUI(); }); //let's define button action based on user state m_Connect.onClick.AddListener(() => { if (!Fb.IsLoggedIn) { SignInFlow(); } else { SignOutFlow(); } }); }
private async void ShareThread() { using (var db = new FbsEntities()) { var token = db.Users.Where(x => x.Id == _id).Select(x => x.Token).FirstOrDefault(); var groups = db.GetGroups(_id, null, "OPEN"); if (groups == null || token == null) { return; } var link = txtLink.Text; _fb = new Fb(token); var rand = new Random(); var count = 0; foreach (var gr in groups) { var msg = _captions[rand.Next(_captions.Count - 1)]; var rp = await _fb.Share(link, gr.Id, msg); var rs = rp.GetType().GetProperty("result")?.GetValue(rp); if (rs != null && !(bool)rs) { var ms = rp.GetType().GetProperty("msg")?.GetValue(rp).ToString(); // MessageBox.Show(ms, @"Error"); var item = _runningThread.SingleOrDefault(x => x.Id == _id); Thread.Sleep(60000); // _runningThread.Remove(item); continue; } count++; if (count % 7 == 0) { Thread.Sleep(300000); } } } }
private void btnAddAccount_Click(object sender, EventArgs e) { var token = txtToken.Text; switch (_action) { case "CREATE": _fb = new Fb(token); var rs = _fb.GetGroups(); break; case "UPDATE": using (var db = new FbsEntities()) { var cUser = db.Users.FirstOrDefault(x => x.Id == _id); if (cUser != null) { cUser.Token = token; db.SaveChanges(); } } break; } }
public UdfDbFunctionFbTests(Fb fixture) : base(fixture) { }
void SignOutFlow() { Fb.LogOut(); UpdateAccountUI(); }
//overwatch Texts //public Text txtOverwatchResourcesLeft; //public Text txtOvertwatchResourcesGathered; //public Text txtOverwatchUnitsLeft; //Talon texts //public Text txtTalonResourcesLeft; //public Text txtTalonResourcesGathered; // public Text txtTalonUnitsLeft; public void GameEng() { txtRound.text = "Round: " + Round; int hero = 0; int villian = 0; foreach (ResourceBuildings u in m.BitCoinMine) { if (u.Faction == Faction.Overwatch) { hero++; } else { villian++; } } foreach (FactoryBuildings u in m.Barracks) { if (u.Faction == Faction.Overwatch) { hero++; } else { villian++; } } foreach (Unit u in m.units) { if (u.factionType == Faction.Overwatch) { villian++; } else { villian++; } } if (hero > 0 && villian > 0) { foreach (ResourceBuildings Rb in m.BitCoinMine) { Rb.GenerateResources(); } foreach (FactoryBuildings Fb in m.Barracks) { if (Round % Fb.ProductionSpeed == 0) { m.SpawnUnits(Fb.SpawnPointX, Fb.SpawnPointY, Fb.Faction, Fb.SpawnUnits()); } } foreach (Unit u in m.units) { u.CheckAttackRange(m.units, m.buildings); } m.Populate(); m.PlaceBuildings(); Round++; // Placebuttons(); } else { m.Populate(); m.PlaceBuildings(); //Placebuttons(); if (hero > villian) { // MessageBox.Show("Hero Wins on Round: " + Round); } else { //MessageBox.Show("Villian Wins on Round: " + Round); } } for (int i = 0; i < m.rangedUnits.Count; i++) { if (m.rangedUnits[i].Death()) { m.map[m.rangedUnits[i].posX, m.rangedUnits[i].posX] = ""; m.rangedUnits.RemoveAt(i); } } for (int i = 0; i < m.meleeUnits.Count; i++) { if (m.meleeUnits[i].Death()) { m.map[m.meleeUnits[i].posX, m.meleeUnits[i].posX] = ""; m.meleeUnits.RemoveAt(i); } } for (int i = 0; i < m.units.Count; i++) { if (m.units[i].Death()) { m.map[m.units[i].posX, m.units[i].posX] = ""; m.units.RemoveAt(i); } } for (int i = 0; i < m.Barracks.Count; ++i) { if (m.Barracks[i].Destruction()) { m.map[m.Barracks[i].PosX, m.Barracks[i].PosY] = ""; m.Barracks.RemoveAt(i); } } for (int i = 0; i < m.BitCoinMine.Count; ++i) { if (m.BitCoinMine[i].Destruction()) { m.map[m.BitCoinMine[i].PosX, m.BitCoinMine[i].PosY] = ""; m.BitCoinMine.RemoveAt(i); } } for (int i = 0; i < m.buildings.Count; ++i) { if (m.buildings[i].Destruction()) { if (m.buildings[i] is FactoryBuildings) { FactoryBuildings FB = (FactoryBuildings)m.buildings[i]; m.map[FB.PosX, FB.PosY] = ""; } else if (m.buildings[i] is ResourceBuildings) { ResourceBuildings RB = (ResourceBuildings)m.buildings[i]; m.map[RB.PosX, RB.PosY] = ""; } m.buildings.RemoveAt(i); } } }
public void Fly() { Fb.Fly(); }
private void button1_Click(object sender, EventArgs e) { var token = txtToken.Text; var fb = new Fb(token); var rs = fb.GetGroups(); }