コード例 #1
0
ファイル: FreeLog.cs プロジェクト: yangfan111/CsharpCode
 public static void Stop(long s, IGameAction action, IEventArgs args)
 {
     if (enable)
     {
         foreach (ParaExp pe in paras)
         {
             IPara p = GetPara(args, pe);
             if (p != null)
             {
                 FreeLog.LogKey key = new FreeLog.LogKey(s, pe.ToString(), action.ToString());
                 if (value.ContainsKey(key))
                 {
                     if (!value[key].GetFrom().Meet("==", p))
                     {
                         // 去除外层的改变action
                         FreeLog.LogKey v = value[key];
                         if (v.seq > lastSeq)
                         {
                             v.to = (IPara)p.Copy();
                             logs.Add(v);
                             lastSeq = v.seq;
                         }
                         value[key].to = (IPara)p.Copy();
                     }
                 }
             }
         }
         index--;
     }
 }
コード例 #2
0
ファイル: GameRepository.cs プロジェクト: KonH/CardGame
 void AddAction(ServerGameState state, IGameAction action)
 {
     state.Actions.Add(action);
     _logger.LogDebug(
         "[{0}] User: '******', action: {2} (state v.{3})",
         state.Session, action.User, action.ToString(), state.SharedState.Version);
     TryAddShowCardAction(state, action);
     TryAddBotAction(state);
 }
コード例 #3
0
        private static void WriteOutput(IGameAction action)
        {
            var s = action.ToString();

            if (action.Message != null)
            {
                s += " " + action.Message;
            }
            Console.WriteLine(s);
        }
コード例 #4
0
ファイル: FreeLog.cs プロジェクト: yangfan111/CsharpCode
 public static void Error(string msg, IGameAction action)
 {
     if (enable)
     {
         errors.Add(msg + "\n    at 动作 '" + (action == null ? string.Empty : action.ToString()) + "'\n    at " + ToTrigger());
         if (errors.Count > 1000)
         {
             errors.Remove(0);
         }
     }
 }
コード例 #5
0
        public override string ToString()
        {
            string s = condition.ToString() + " ? ";

            if (trueAction != null)
            {
                s = s + " true->" + trueAction.ToString();
            }
            if (falseAction != null)
            {
                s = s + " false->" + falseAction.ToString();
            }
            return(s);
        }
コード例 #6
0
ファイル: FreeLog.cs プロジェクト: yangfan111/CsharpCode
 public static long Start(IGameAction action, IEventArgs args)
 {
     if (enable)
     {
         long s = Runtime.NanoTime();
         foreach (ParaExp pe in paras)
         {
             IPara p = GetPara(args, pe);
             if (p != null)
             {
                 FreeLog.LogKey key = new FreeLog.LogKey(s, pe.ToString(), action.ToString());
                 key.index  = index;
                 key.seq    = value.Count + 1;
                 key.from   = (IPara)p.Copy();
                 value[key] = key;
             }
         }
         index++;
         return(s);
     }
     return(0L);
 }