コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AGSSyncableNumberElement"/> class.
 /// </summary>
 /// <param name='listOwningThisNumber'>
 /// List owner.
 /// </param>
 /// <param name='indexInList'>
 /// List index.
 /// </param>
 /// <param name='numberKeyVal'>
 /// Number key value.
 /// </param>
 /// <param name='syncableMethod'>
 /// Syncable method.
 /// </param>
 public AGSSyncableNumberElement(AGSSyncableNumberList listOwningThisNumber,
                                 int indexInList,
                                 SyncableMethod syncableMethod) : base(listOwningThisNumber, indexInList, syncableMethod)
 {
     numberBehavior = SyncableBehaviorFromSyncableMethod(syncableMethod);
     InitializeNativeFunctionCalls();
 }
コード例 #2
0
    /// <summary>
    /// Initializes the native function calls.
    /// </summary>
    void InitializeNativeFunctionCalls()
    {
        // Does nothing in editor mode so these functions remain null.
#if !UNITY_EDITOR
        // If the number is owned by a list, the list handles the calls to native code.
        if (null != listOwner && listIndex.HasValue && listOwner is AGSSyncableNumberList)
        {
            AGSSyncableNumberList asNumberList = listOwner as AGSSyncableNumberList;
            getNumberAsInt    = (k) => { return(asNumberList.GetValueAtIndexAsInt(listIndex.Value)); };
            getNumberAsInt64  = (k) => { return(asNumberList.GetValueAtIndexAsLong(listIndex.Value)); };
            getNumberAsDouble = (k) => { return(asNumberList.GetValueAtIndexAsDouble(listIndex.Value)); };
            getNumberAsString = (k) => { return(asNumberList.GetValueAtIndexAsString(listIndex.Value)); };
        }
        else
        {
            // Doing a single switch here keeps each individual function smaller and cleaner.
            switch (numberBehavior)
            {
            case SyncableNumberBehavior.Highest:
                getNumberAsInt    = _AmazonGCWSGetHighestNumberInt;
                getNumberAsInt64  = _AmazonGCWSGetHighestNumberInt64;
                getNumberAsDouble = _AmazonGCWSGetHighestNumberDouble;
                getNumberAsString = _AmazonGCWSGetHighestNumberString;
                break;

            case SyncableNumberBehavior.Lowest:
                getNumberAsInt    = _AmazonGCWSGetLowestNumberInt;
                getNumberAsInt64  = _AmazonGCWSGetLowestNumberInt64;
                getNumberAsDouble = _AmazonGCWSGetLowestNumberDouble;
                getNumberAsString = _AmazonGCWSGetLowestNumberString;
                break;

            case SyncableNumberBehavior.Latest:
                getNumberAsInt    = _AmazonGCWSGetLatestNumberInt;
                getNumberAsInt64  = _AmazonGCWSGetLatestNumberInt64;
                getNumberAsDouble = _AmazonGCWSGetLatestNumberDouble;
                getNumberAsString = _AmazonGCWSGetLatestNumberString;
                break;

            default:
                logUnhandledBehaviorError();
                break;
            }
        }
#endif
    }
    /// <summary>
    /// Initializes the syncable number list.
    /// </summary>
    /// <param name='dataMap'>
    /// Data map.
    /// </param>
    void InitSyncableNumberList(AGSGameDataMap dataMap)
    {
        // initialize the list based on what type of list it is.
        switch (listType)
        {
        case AvailableListType.HighNumber:
            syncableNumberList = dataMap.GetHighNumberList(ListName());
            break;

        case AvailableListType.LatestNumber:
            syncableNumberList = dataMap.GetLatestNumberList(ListName());
            break;

        case AvailableListType.LowNumber:
            syncableNumberList = dataMap.GetLowNumberList(ListName());
            break;
        }
        // cache the size and if the list has been set.
        maxSize = syncableNumberList.GetMaxSize();
        isSet   = syncableNumberList.IsSet();
    }
コード例 #4
0
 /// <summary>
 /// Initializes the syncable number list.
 /// </summary>
 /// <param name='dataMap'>
 /// Data map.
 /// </param>
 void InitSyncableNumberList(AGSGameDataMap dataMap)
 {
     // initialize the list based on what type of list it is.
     switch(listType) {
     case AvailableListType.HighNumber:
         syncableNumberList = dataMap.GetHighNumberList(ListName());
         break;
     case AvailableListType.LatestNumber:
         syncableNumberList = dataMap.GetLatestNumberList(ListName());
         break;
     case AvailableListType.LowNumber:
         syncableNumberList = dataMap.GetLowNumberList(ListName());
         break;
     }
     // cache the size and if the list has been set.
     maxSize = syncableNumberList.GetMaxSize();
     isSet = syncableNumberList.IsSet();
 }
コード例 #5
0
ファイル: AGSSyncableNumber.cs プロジェクト: EJBQ/Bae-Zeus-X
 /// <summary>
 /// Initializes a new instance of the <see cref="AGSSyncableNumber"/> class.
 /// </summary>
 /// <param name='listOwner'>
 /// List owner.
 /// </param>
 /// <param name='listIndex'>
 /// List index.
 /// </param>
 /// <param name='syncableMethod'>
 /// Syncable method.
 /// </param>
 public AGSSyncableNumber(AGSSyncableNumberList listOwner, 
                         int listIndex, 
                         SyncableMethod syncableMethod) : base(listOwner, listIndex, syncableMethod) {
     InitializeNativeFunctionCalls();
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AGSSyncableNumber"/> class.
 /// </summary>
 /// <param name='listOwner'>
 /// List owner.
 /// </param>
 /// <param name='listIndex'>
 /// List index.
 /// </param>
 /// <param name='syncableMethod'>
 /// Syncable method.
 /// </param>
 public AGSSyncableNumber(AGSSyncableNumberList listOwner,
                          int listIndex,
                          SyncableMethod syncableMethod) : base(listOwner, listIndex, syncableMethod)
 {
     InitializeNativeFunctionCalls();
 }