コード例 #1
0
 public static VariableType GetVariableType(this SocketUserVars v)
 {
     if (!typeMap.ContainsKey(v))
     {
         Log.LogError(v, string.Concat("Socket user var `", v, "` has no type"));
         throw new Exception(string.Concat("Socket user var `", v, "` has no type"));
     }
     return(typeMap[v]);
 }
コード例 #2
0
 public static string GetKey(this SocketUserVars v)
 {
     if (!keyMap.ContainsKey(v))
     {
         Log.LogError(v, string.Concat("Socket user var `", v, "` has no key"));
         throw new Exception(string.Concat("Socket user var `", v, "` has no key"));
     }
     return(keyMap[v]);
 }
コード例 #3
0
    private void addIfChanged(List <UserVariable> userVariables, SocketUserVars key, object newValue)
    {
        Type   typeFromSFSVariableType = SmartFoxUtil.GetTypeFromSFSVariableType(key.GetVariableType());
        object obj = (newValue == null) ? null : Convert.ChangeType(newValue, typeFromSFSVariableType);

        if (mt.isLoggedIn)
        {
            UserVariable var  = null;
            bool         flag = mt.TryGetUserVariable(key.GetKey(), out var);
            if ((!flag && obj != null) || (flag && obj != SmartFoxUtil.GetValueFromSFSUserValue(var, typeFromSFSVariableType)))
            {
                userVariables.Add(new SFSUserVariable(key.GetKey(), obj));
            }
        }
    }
コード例 #4
0
 private static MemberInfo ForValue(SocketUserVars v)
 {
     return(typeof(SocketUserVars).GetField(Enum.GetName(typeof(SocketUserVars), v)));
 }
コード例 #5
0
 private static SocketUserVarAttribute GetAttr(SocketUserVars v)
 {
     return((SocketUserVarAttribute)Attribute.GetCustomAttribute(ForValue(v), typeof(SocketUserVarAttribute)));
 }