Пример #1
0
 public static object GetValueFromSFSUserValue(UserVariable sfsValue, Type type)
 {
     if (sfsValue.IsNull())
     {
         return(null);
     }
     if (type == typeof(bool))
     {
         return(Convert.ChangeType(sfsValue.GetBoolValue(), type));
     }
     if (type == typeof(double))
     {
         return(Convert.ChangeType(sfsValue.GetDoubleValue(), type));
     }
     if (type == typeof(int))
     {
         return(Convert.ChangeType(sfsValue.GetIntValue(), type));
     }
     if (type == typeof(string))
     {
         return(Convert.ChangeType(sfsValue.GetStringValue(), type));
     }
     if (type == typeof(SFSObject))
     {
         return(Convert.ChangeType(sfsValue.GetSFSObjectValue(), type));
     }
     return(Convert.ChangeType(sfsValue.GetSFSObjectValue(), type));
 }
Пример #2
0
 internal void TriggerBinaryStateEvent(UserVariable state, long sessionId, GameServerEvent gameServerEvent)
 {
     if (state == null || state.IsNull())
     {
         mt.triggerEvent(gameServerEvent, new BinaryState(sessionId, isTrue: false));
     }
     else
     {
         mt.triggerEvent(gameServerEvent, new BinaryState(sessionId, state.GetBoolValue()));
     }
 }
Пример #3
0
    public static void HandleRoomVariableUpdate(UserVariable userVar)
    {
        List <RoomVariableToEnable> rmVarToEnableList;

        if (allRmVarToEnables.TryGetValue(userVar.Name, out rmVarToEnableList))
        {
            for (int i = 0; i < rmVarToEnableList.Count; ++i)
            {
                rmVarToEnableList[i].gameObject.SetActive(userVar.GetBoolValue());
            }
        }
    }
Пример #4
0
 public void UpdateUserVar(UserVariable userVar, bool fromReplay = false)
 {
     if (userVar.Name == "spd")
     {
         UpdateSpeed(userVar);
     }
     else if (userVar.Name == "ptype")
     {
         UpdateType(userVar);
     }
     else if (userVar.Name == "modelAnimation")
     {
         UpdateAnimState(userVar);
     }
     else if (userVar.Name == "op")
     {
         ApplyAvatarOptions(userVar.GetStringValue());
     }
     else if (userVar.Name == "parseId")
     {
         string postfix = fromReplay ? ">" : "";
         ParseId = userVar.GetStringValue() + postfix;
     }
     else if (userVar.Name == "displayName")
     {
         DisplayName = userVar.GetStringValue();
     }
     else if (userVar.Name == "team")
     {
         teamID = userVar.GetIntValue();
     }
     else if (userVar.Name == "gt" || userVar.Name == "gp")
     {
         UpdateGaze(userVar.Name, (float)userVar.GetDoubleValue());
     }
     else if (userVar.Name == "sit")
     {
         UpdateSit(userVar.GetBoolValue());
     }
     else if (userVar.Name == "scl")
     {
         UpdateScale((float)userVar.GetDoubleValue());
     }
     else
     {
         Debug.LogError("Unsupported userVar: " + userVar.Name);
     }
 }