/// <summary> /// Gets the AGS syncable. /// </summary> /// <returns> /// The AGS syncable. /// </returns> /// <param name='method'> /// Method. /// </param> /// <param name='key'> /// Key. /// </param> /// <typeparam name='T'> /// The 1st type parameter. /// </typeparam> protected T GetAGSSyncable <T>(SyncableMethod method, string key) { #if UNITY_ANDROID AndroidJavaObject jo; if (key != null) { jo = javaObject.Call <AndroidJavaObject>(method.ToString(), key); } else { jo = javaObject.Call <AndroidJavaObject>(method.ToString()); } if (jo != null) { return((T)Activator.CreateInstance(typeof(T), new object[] { jo })); } //return null or 0 as appropriate to the data type returned return(default(T)); #elif UNITY_IOS return((T)Activator.CreateInstance(typeof(T), key, method)); #else //return null or 0 as appropriate to the data type returned return(default(T)); #endif }
/// <summary> /// Syncables the method to list behavior. /// </summary> /// <returns> /// The method to list behavior. /// </returns> /// <param name='syncableMethod'> /// Syncable method. /// </param> SyncableListBehavior SyncableMethodToListBehavior(SyncableMethod syncableMethod) { switch (syncableMethod) { case SyncableMethod.getHighestNumber: case SyncableMethod.getHighNumberList: return(SyncableListBehavior.HighNumber); case SyncableMethod.getLatestNumber: case SyncableMethod.getLatestNumberList: return(SyncableListBehavior.LatestNumber); case SyncableMethod.getLowestNumber: case SyncableMethod.getLowNumberList: return(SyncableListBehavior.LowNumber); case SyncableMethod.getLatestString: case SyncableMethod.getLatestStringList: return(SyncableListBehavior.LatestString); default: AGSClient.LogGameCircleError(string.Format("Unhandled AGSSyncableNumberList type {0}", syncableMethod.ToString())); // still need to return something if error logging is set to a level less than exception. return(SyncableListBehavior.HighNumber); } }
/// <summary> /// Syncables the method to list behavior. /// </summary> /// <returns> /// The method to list behavior. /// </returns> /// <param name='syncableMethod'> /// Syncable method. /// </param> SyncableListBehavior SyncableMethodToListBehavior(SyncableMethod syncableMethod) { switch(syncableMethod) { case SyncableMethod.getHighestNumber: case SyncableMethod.getHighNumberList: return SyncableListBehavior.HighNumber; case SyncableMethod.getLatestNumber: case SyncableMethod.getLatestNumberList: return SyncableListBehavior.LatestNumber; case SyncableMethod.getLowestNumber: case SyncableMethod.getLowNumberList: return SyncableListBehavior.LowNumber; case SyncableMethod.getLatestString: case SyncableMethod.getLatestStringList: return SyncableListBehavior.LatestString; default: AGSClient.LogGameCircleError(string.Format("Unhandled AGSSyncableNumberList type {0}",syncableMethod.ToString())); // still need to return something if error logging is set to a level less than exception. return SyncableListBehavior.HighNumber; } }
/// <summary> /// Initializes the behavior of the syncable number element for iOS. /// </summary> /// <param name='syncableMethod'> /// Syncable method. /// </param> SyncableNumberBehavior SyncableBehaviorFromSyncableMethod(SyncableMethod syncableMethod) { switch (syncableMethod) { case SyncableMethod.getHighestNumber: case SyncableMethod.getHighNumberList: return(SyncableNumberBehavior.Highest); case SyncableMethod.getLatestNumber: case SyncableMethod.getLatestNumberList: return(SyncableNumberBehavior.Latest); case SyncableMethod.getLowestNumber: case SyncableMethod.getLowNumberList: return(SyncableNumberBehavior.Lowest); default: AGSClient.LogGameCircleError(string.Format("Unhandled SyncableNumberElement type {0}", syncableMethod.ToString())); return(SyncableNumberBehavior.Latest); } }