示例#1
0
        public void LogLevelEnd(string levelName, double score, bool levelCompletedSuccesfully,
                                Dictionary <string, object> customAttributes = null)
        {
            var answersEvent = new LevelEndEvent();

            answersEvent.PutLevelName(levelName);
            answersEvent.PutScore(Double.ValueOf(score));
            answersEvent.PutSuccess(levelCompletedSuccesfully);
            answersEvent.PutCustomAttributes(customAttributes);
            Bindings.AnswersKit.Answers.Instance.LogLevelEnd(answersEvent);
        }
示例#2
0
 internal static void PutCustomAttributes(this AnswersEvent answersEvent,
                                          Dictionary <string, object> customAttributes)
 {
     if (customAttributes == null)
     {
         return;
     }
     foreach (var customAttribute in customAttributes)
     {
         if (customAttribute.Value is int)
         {
             answersEvent.PutCustomAttribute(customAttribute.Key, Integer.ValueOf((int)customAttribute.Value));
         }
         else if (customAttribute.Value is long)
         {
             answersEvent.PutCustomAttribute(customAttribute.Key, Long.ValueOf((long)customAttribute.Value));
         }
         else if (customAttribute.Value is float)
         {
             answersEvent.PutCustomAttribute(customAttribute.Key, Float.ValueOf((float)customAttribute.Value));
         }
         else if (customAttribute.Value is double)
         {
             answersEvent.PutCustomAttribute(customAttribute.Key,
                                             Double.ValueOf((double)customAttribute.Value));
         }
         else if (customAttribute.Value is short)
         {
             answersEvent.PutCustomAttribute(customAttribute.Key, Short.ValueOf((short)customAttribute.Value));
         }
         else if (customAttribute.Value is sbyte)
         {
             answersEvent.PutCustomAttribute(customAttribute.Key,
                                             Byte.ValueOf((sbyte)customAttribute.Value));
         }
         else if (customAttribute.Value is decimal)
         {
             answersEvent.PutCustomAttribute(customAttribute.Key,
                                             new BigDecimal(customAttribute.Value.ToString()));
         }
         else
         {
             answersEvent.PutCustomAttribute(customAttribute.Key, customAttribute.Value?.ToString());
         }
     }
 }