private void OnTriggerExit2D(Collider2D other) { if (other.gameObject.tag == "Player") { socialState = SocialState.idle; } }
public void EnteredInQueue() { if (socialState != SocialState.END) { socialState = SocialState.ON_QUEUE; //interact on enter in queue } }
private void OnTriggerStay2D(Collider2D other) { if (other.gameObject.tag == "Player") { if (socialState == SocialState.idle) { socialState = SocialState.looking; } } }
/// <summary> /// Before running this function, log the last social state /// </summary> public static bool Prefix(string showCategory) { UnityEngine.Debug.Log("Updating tracker state."); if (state_translator.ContainsKey(showCategory)) { last_state = state_translator[showCategory]; } return(true); }
private void OnEnable() { if (AvaibleInteractions != 0) { socialState = SocialState.FREE; NpcInteracted = new List <WorldState.NPCName>(); } else { socialState = SocialState.END; } }
private void OnTriggerExit2D(Collider2D other) { if (other.gameObject.tag == "Player") { if (socialState == SocialState.angry) { socialState = SocialState.idle; //Wwise stukje AkSoundEngine.PostEvent("Stop_Social_Gordeldier", gameObject); } } }
private IEnumerator ScareLogic() { canStartCoroutine = false; socialState = SocialState.scare; yield return(new WaitForSeconds(0.1f)); Scare(); yield return(new WaitForSeconds(0.1f)); fadeBlackScreenScr.StartCoroutine(fadeBlackScreenScr.FadeOut(0.1f)); yield return(new WaitForSeconds(scareAnimationTime - 0.1f - 0.1f)); socialState = SocialState.idle; yield return(new WaitForSeconds(scareCooldown)); canStartCoroutine = true; }
private void OnInitComplateDelegate() { if (FB.IsInitialized) { m_SocialState = SocialState.Init; FB.ActivateApp(); } else { m_SocialState = SocialState.Error; Log.e("FaceBook SDK Init Failed"); } if (FB.IsLoggedIn) { m_SocialState = SocialState.Logined; } }
public void LogOutSocialPlatform() { if (!FB.IsInitialized) { return; } if (m_SocialState < SocialState.Logined) { return; } m_SocialState = SocialState.Init; FB.LogOut(); m_Mgr.ClearAllData(); m_FriendsDataTimeRecorder.Reset(); m_RankDataTimeRecorder.Reset(); EventSystem.S.Send(SDKEventID.OnFBLogoutEvent); }
private IEnumerator LaughCoroutine() { float a = beforeLaughTime * 0.5f; float b = beforeLaughTime * 3f; float beforeLaughTimeFinal = Random.Range(a, b); yield return(new WaitForSeconds(beforeLaughTimeFinal)); socialState = SocialState.laughing; float a2 = laughTime * 0.75f; float b2 = laughTime * 1.25f; float laughTimeFinal = Random.Range(a2, b2); var main = ps_laugh.main; main.duration = laughTimeFinal - 0.5f; ps_laugh.Play(); //Wwise stukje AkSoundEngine.PostEvent("Social_Laughing", gameObject); yield return(new WaitForSeconds(laughTimeFinal)); socialState = SocialState.idle; }
private void OnLoginWithReadPermissions() { m_SocialState = SocialState.Logined; RefreshPlayerInfo(selfUserID); }
protected string GetState(bool write_to_file) { SocialState state = new SocialState(); state.LocalUser = _local_user.ChangedCopy(_local_user.IP, String.Empty, String.Empty, _status); state.Friends = new SocialUser[_friends.Count]; state.BlockedFriends = new string[_bfriends.Count]; _friends.Values.CopyTo(state.Friends, 0); _bfriends.CopyTo(state.BlockedFriends, 0); if(write_to_file) { Utils.WriteConfig(STATEPATH, state); } return SocialUtils.ObjectToXml<SocialState>(state); }
private void OnLoginWithPublishPermission() { m_SocialState = SocialState.PublishPermission; RefreshPlayerInfo(selfUserID); }
/// <summary> /// 绑定社交账号后的回调函数,使用场景 /// 1.直接采用社交账号登陆 /// 2.平台账号登陆后->绑定新的社交账号 /// </summary> public ActionResult Social_Callback(string type) { SocialState ssResponse = new SocialState(); try { //判断登陆的社交账户类型(默认为新浪微博账号) String req_type = (String.IsNullOrEmpty(type)) ? "1" : type; SocialUserTypeEnum socialUserTypeEnum = (SocialUserTypeEnum)Enum.Parse(typeof(SocialUserTypeEnum), req_type); //初始化社交账户结构体 SocialUser socialUser = new SocialUser(); socialUser.SocialUserType = socialUserTypeEnum; #region 获取社交账号的access_token及security_key switch (socialUserTypeEnum) { case SocialUserTypeEnum.Sina: ISinaoAuth sina_oAuthService = new SinaOAuthService(); string _code = Request["code"]; string access_code = string.Empty; string sina_uid = string.Empty; bool _isOk = sina_oAuthService.GetAccessToken(_code, out access_code, out sina_uid); socialUser.AccessToken = access_code; socialUser.Uid = sina_uid; ssResponse.SocialType = "新浪微博"; break; case SocialUserTypeEnum.QQ: IQoAuth oAuthService = new QoAuthService(); string verifierCode = Request["code"]; //QoAuthKey oAuthKey = (QoAuthKey)Session[sKey_QQoAuthKey]; QoAuthKey oAuthKey = SecurityHelper.DecryptObject <QoAuthKey>(CookieHelper.Get(sKey_QQoAuthKey), null); oAuthService.GetAccessToken(verifierCode, ref oAuthKey); socialUser.AccessToken = oAuthKey.Access_Token; socialUser.AccessTokenSecret = oAuthKey.State; socialUser.Uid = oAuthKey.OpenId; ssResponse.SocialType = "QQ"; break; default: break; } #endregion //Session[sKey_SocialUserKey] = socialUser; CookieHelper.Set(sKey_SocialUserKey, SecurityHelper.EncryptObject(socialUser), DateTime.Now.AddHours(1)); //用户业务逻辑服务 #region 社交账号登陆 //社交账号登陆 if (socialUserTypeEnum == SocialUserTypeEnum.QQ || socialUserTypeEnum == SocialUserTypeEnum.Sina) { //检查社交账号是否和平台账号绑定 UserServiceClient client = new UserServiceClient(); AdvancedResult <string> result = client.IsBindSocialUser(socialUser); ssResponse.Logined = true; if (result.Error == AppError.ERROR_SUCCESS) { //跳转到个人中心 AdvancedResult <AdUser> aduser = client.GetUserInfo(result.Data); ssResponse.Binded = true; if (aduser.Error == AppError.ERROR_SUCCESS) { WriteAuthCookie(aduser.Data.UserAccount, result.Data); Response.AddHeader("P3P", "CP=CAO PSA OUR"); ssResponse.Name = aduser.Data.UserAccount; } CookieHelper.Remove(sKey_SocialUserKey); } else { //提示绑定 ssResponse.Binded = false; } client.Close(); client = null; } else { ssResponse.Logined = false; } #endregion } catch (Exception ex) { ssResponse.Logined = false; ssResponse.Message = ex.Message; } ViewBag.LoginResponse = JsonHelper.Serialize(ssResponse); return(View("~/Views/Account/socialcallback.cshtml")); }
public string GetState(bool write) { #if SVPN_NUNIT return(String.Empty); #else FileState fstate = new FileState(); SocialState state = new SocialState(); if (_node.LocalUser != null) { state.LocalUser = _node.LocalUser; fstate.Uid = state.LocalUser.Uid; fstate.PCID = state.LocalUser.PCID; } state.Friends = new SocialUser[_node.Friends.Values.Count]; state.Networks = new NetworkState[_networks.Values.Count]; state.Pending = new string[_pending.Count]; fstate.Friends = new FriendState[_node.Friends.Values.Count]; _pending.CopyTo(state.Pending, 0); int i = 0; foreach (KeyValuePair <string, ISocialNetwork> kvp in _networks) { state.Networks[i] = new NetworkState(); state.Networks[i].Name = kvp.Key; state.Networks[i].Message = kvp.Value.Message; i++; } i = 0; foreach (SocialUser user in _node.Friends.Values) { string status; if (_node.IsAllowed(user.Address)) { if (IsOffline(user.Address)) { status = StatusTypes.Offline.ToString(); } else { status = StatusTypes.Online.ToString(); } } else { status = StatusTypes.Blocked.ToString(); } state.Friends[i] = new SocialUser(user.Certificate, user.IP, status); FriendState friend = new FriendState(); friend.Certificate = user.Certificate; friend.IP = user.IP; friend.Status = status; fstate.Friends[i] = friend; i++; } if (write) { Utils.WriteConfig(STATEPATH, fstate); } return(SocialUtils.ObjectToXml <SocialState>(state)); #endif }
public FriendInfo(Character character, SocialState socialState) { this.character = character; this.socialState = socialState; }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); if (PhoneApplicationService.Current.State.ContainsKey("FromSocialPage")) // shows page is navigated from social page { PhoneApplicationService.Current.State.Remove("FromSocialPage"); ChangeElementsState(false); object oo; SocialState ss = SocialState.DEFAULT; if (PhoneApplicationService.Current.State.TryGetValue("socialState", out oo)) { ss = (SocialState)oo; PhoneApplicationService.Current.State.Remove("socialState"); } switch (ss) { case SocialState.FB_LOGIN: ChangeElementsState(false); JObject oj = new JObject(); oj["id"] = (string)App.appSettings[HikeConstants.AppSettings.FB_USER_ID]; oj["token"] = (string)App.appSettings[HikeConstants.AppSettings.FB_ACCESS_TOKEN]; AccountUtils.SocialPost(oj, new AccountUtils.postResponseFunction(SocialPostFB), HikeConstants.FACEBOOK, true); break; case SocialState.FB_LOGOUT: ChangeElementsState(false); AccountUtils.SocialPost(null, new AccountUtils.postResponseFunction(SocialDeleteFB), HikeConstants.FACEBOOK, false); break; case SocialState.TW_LOGIN: JObject ojj = new JObject(); ojj["id"] = (string)App.appSettings[HikeConstants.AppSettings.TWITTER_TOKEN];; ojj["token"] = (string)App.appSettings[HikeConstants.AppSettings.TWITTER_TOKEN_SECRET]; AccountUtils.SocialPost(ojj, new AccountUtils.postResponseFunction(SocialPostTW), HikeConstants.TWITTER, true); break; default: ChangeElementsState(true); break; } } else { if (App.appSettings.Contains(HikeConstants.FB_LOGGED_IN)) { IsFacebookConnected = true; } else { IsFacebookConnected = false; } if (App.appSettings.Contains(HikeConstants.TW_LOGGED_IN)) { IsTwitterConnected = true; } else { IsTwitterConnected = false; } } }
public string GetState(bool write) { #if SVPN_NUNIT return String.Empty; #else FileState fstate = new FileState(); SocialState state = new SocialState(); if(_node.LocalUser != null) { state.LocalUser = _node.LocalUser; fstate.Uid = state.LocalUser.Uid; fstate.PCID = state.LocalUser.PCID; } state.Friends = new SocialUser[_node.Friends.Values.Count]; state.Networks = new NetworkState[_networks.Values.Count]; state.Pending = new string[_pending.Count]; fstate.Friends = new FriendState[_node.Friends.Values.Count]; _pending.CopyTo(state.Pending, 0); int i = 0; foreach (KeyValuePair<string, ISocialNetwork> kvp in _networks) { state.Networks[i] = new NetworkState(); state.Networks[i].Name = kvp.Key; state.Networks[i].Message = kvp.Value.Message; i++; } i = 0; foreach(SocialUser user in _node.Friends.Values) { string status; if(_node.IsAllowed(user.Address)) { if(IsOffline(user.Address)) { status = StatusTypes.Offline.ToString(); } else { status = StatusTypes.Online.ToString(); } } else { status = StatusTypes.Blocked.ToString(); } state.Friends[i] = new SocialUser(user.Certificate, user.IP, status); FriendState friend = new FriendState(); friend.Certificate = user.Certificate; friend.IP = user.IP; friend.Status = status; fstate.Friends[i] = friend; i++; } if(write) { Utils.WriteConfig(STATEPATH, fstate); } return SocialUtils.ObjectToXml<SocialState>(state); #endif }
public ErrorCodes SetFriendSocialState(Character friend, SocialState socialState, string note = null) { if (character.Id == 0 || character == friend) { return(ErrorCodes.NoError); } if (socialState == SocialState.Blocked) { var friendAccessLevel = friend.AccessLevel; if (friendAccessLevel.IsAdminOrGm()) { return(ErrorCodes.AdminIsNotBlockable); } } var lastStateUpdate = DateTime.Now; FriendInfo friendInfo; if (_friends.TryGetValue(friend, out friendInfo)) { if (friendInfo.socialState == socialState) { return(ErrorCodes.NoError); } friendInfo.socialState = socialState; // update const string updateCommandText = "update charactersocial set socialstate = @socialState,laststateupdate = @lastStateUpdate,note = @note where characterid = @characterId and friendid = @friendId"; var sqlResult = Db.Query().CommandText(updateCommandText) .SetParameter("@characterId", character.Id) .SetParameter("@friendId", friend.Id) .SetParameter("@socialState", socialState) .SetParameter("@lastStateUpdate", lastStateUpdate) .SetParameter("@note", note) .ExecuteNonQuery(); if (sqlResult == 0) { return(ErrorCodes.SQLUpdateError); } } else { // insert const string insertCommandText = "insert into charactersocial (characterid,friendid,socialstate,laststateupdate,note) values (@characterId,@friendId,@socialState,@lastStateUpdate,@note)"; var sqlResult = Db.Query().CommandText(insertCommandText) .SetParameter("@characterId", character.Id) .SetParameter("@friendId", friend.Id) .SetParameter("@socialState", socialState) .SetParameter("@lastStateUpdate", lastStateUpdate) .SetParameter("@note", note) .ExecuteNonQuery(); if (sqlResult == 0) { return(ErrorCodes.SQLInsertError); } friendInfo = new FriendInfo(friend, socialState); } friendInfo.lastStateUpdate = lastStateUpdate; friendInfo.note = note; Transaction.Current.OnCommited(() => { _friends[friend] = friendInfo; }); return(ErrorCodes.NoError); }