Exemplo n.º 1
0
 public void IncTimeAtBoogie(DebugData debugData, double time)
 {
     if (debugData != null)
     {
         debugData.TimeAtBoogie += time;
     }
 }
Exemplo n.º 2
0
 private static void IncCallsToBoogie(DebugData debugData)
 {
     if (debugData != null)
     {
         debugData.CallsToBoogie++;
     }
 }
Exemplo n.º 3
0
 private static void IncCallsToDafny(DebugData debugData)
 {
     if (debugData != null)
     {
         debugData.CallsToDafny++;
     }
 }
Exemplo n.º 4
0
 private static void IncVerificationSuccess(DebugData debugData)
 {
     if (debugData != null)
     {
         debugData.VerificationSucc++;
     }
 }
Exemplo n.º 5
0
 private static void IncVerificationFailure(DebugData debugData)
 {
     if (debugData != null)
     {
         debugData.VerificationFailure++;
     }
 }
Exemplo n.º 6
0
 public void IncTotalBranchCount(DebugData debugData)
 {
     if (debugData != null)
     {
         debugData.TotalBranchCount++;
     }
 }
Exemplo n.º 7
0
 private static void IncTimeAtDafny(DebugData debugData, double time)
 {
     if (debugData != null)
     {
         debugData.TimeAtDafny += time;
     }
 }
Exemplo n.º 8
0
        private void SetupDebugData()
        {
            var c    = DebugData.GetDebugCharacter();
            var guys = new List <Character>()
            {
                c
            };
            var cost = new List <int>()
            {
                3
            };

            ShowRecruits(guys, cost);

            Manpower    = 20;
            Requisition = 20;

            List <Item> items     = new List <Item>();
            List <int>  itemCosts = new List <int>();

            for (int i = 0; i < 5; i++)
            {
                items.Add(DebugData.GetProvisions());
                itemCosts.Add(1);
            }
            items.Add(new Item("Longsword"));
            itemCosts.Add(4);
            ShowItems(items, itemCosts);
        }
        public void DebugAttackArmorTest()
        {
            var DM     = DungeonMaster.GetDebugDM(data);
            var attack = DebugData.GetDebugAttackAction();

            var robby = DM.Characters[0];
            var zach  = DM.Characters[1];

            zach.Conditions.Add(new Condition("Dodging", 3));

            var outcome = new Outcome();

            DM.Activate(robby);
            attack.ResolveAction(DM, robby, null, zach, "", outcome);
            //not adjacent so nothing happens
            Assert.IsTrue(zach.Vitality.Value == zach.Vitality.Max);

            zach.Pos = robby.Pos + Map.DirectionToPosition[Map.Direction.E];
            Deck.SetFate(new List <string>()
            {
                "Glancing Blow"
            });
            attack.ResolveAction(DM, robby, null, zach, "", outcome);
            Assert.IsTrue(zach.Vitality.Value < zach.Vitality.Max);
            Assert.AreEqual(zach.Vitality.Max - robby.Strength.Value - robby.WeaponDamage + zach.ArmorProtection, zach.Vitality.Value);
        }
        public void DebugAttackDeckTest()
        {
            var DM     = DungeonMaster.GetDebugDM(data);
            var attack = DebugData.GetDebugAttackAction();

            var robby = DM.Characters[0];
            var zach  = DM.Characters[1];


            var deck = attack.GetDeckFor(DM, robby, null, zach);

            Assert.AreEqual(robby.Profeciency.Value + robby.WeaponAdvantage - zach.ArmorCoverage, deck.Cards.Count(c => c.TypeOfCard == Card.CardType.Hit));
            Assert.AreEqual(zach.ArmorCoverage, deck.Cards.Count(c => c.TypeOfCard == Card.CardType.Armor));
            Assert.AreEqual(2, deck.Cards.Count(c => c.TypeOfCard == Card.CardType.Miss));

            int dodgeCards = 3;

            zach.Conditions.Add(new Condition("Dodging", dodgeCards));

            deck = attack.GetDeckFor(DM, robby, null, zach);

            Assert.AreEqual(robby.Profeciency.Value + robby.WeaponAdvantage - zach.ArmorCoverage, deck.Cards.Count(c => c.TypeOfCard == Card.CardType.Hit));
            Assert.AreEqual(zach.ArmorCoverage, deck.Cards.Count(c => c.TypeOfCard == Card.CardType.Armor));
            Assert.AreEqual(2 + dodgeCards, deck.Cards.Count(c => c.TypeOfCard == Card.CardType.Miss));
        }
Exemplo n.º 11
0
        public DebugData CreateData()
        {
            var data = new DebugData();

            m_DatasBuffer.Enqueue(data);
            return(data);
        }
Exemplo n.º 12
0
            public static new Add ReadFrom(System.IO.BinaryReader reader)
            {
                DebugData debugData = Model.DebugData.ReadFrom(reader);
                var       result    = new Add(debugData);

                return(result);
            }
Exemplo n.º 13
0
    public void Add(DebugData debugData)
    {
        string expandKey = debugData.ID;
        string foldKey   = debugData.StackTrace + debugData.Condition;

        dicExpandAllData.Add(expandKey, debugData);

        if (!dicFoldAllData.ContainsKey(foldKey))
        {
            DebugData newData = new DebugData();
            newData.Condition  = debugData.Condition;
            newData.Count      = 1;
            newData.StackTrace = debugData.StackTrace;
            newData.Tiem       = debugData.Tiem;
            newData.Type       = debugData.Type;

            dicFoldAllData.Add(foldKey, newData);
        }
        else
        {
            dicFoldAllData[foldKey].Count++;
        }

        switch (collapseState)
        {
        case CollapseState.Fold: AddCurrentData(foldKey, debugData); break;

        case CollapseState.Expand: AddCurrentData(expandKey, debugData); break;
        }

        UpdataDebugCount();
    }
Exemplo n.º 14
0
        public static void Tick()
        {
            if (m_WaitingList.Count > 0)
            {
                lock (s_Lock)
                {
                    for (int i = 0; i < m_WaitingList.Count; i++)
                    {
                        DebugData data = m_WaitingList[i];
                        switch (data.type)
                        {
                        case LogType.Log:
                            DebugLog(data.channel, data.message); break;

                        case LogType.Warning:
                            Warning(data.channel, data.message); break;

                        case LogType.Error:
                            Error(data.channel, data.message); break;
                        }
                    }
                    m_WaitingList.Clear();
                }
            }
        }
Exemplo n.º 15
0
    public static DebugData AddLine(GameObject source, string debugString, Color color, KeyCode drawKeyCode = KeyCode.F15, int size = 14, bool isAttachedToObject = false)
    {
        //Check if is debug build else do nothing
        if (!Debug.isDebugBuild)
        {
            return(null);
        }


        if (instance == null || instance.Equals(null))
        {
            instance     = new GameObject("DebugHelper").AddComponent <DebugHelper>();
            instance.tag = "DebugHelper";
        }

        DebugData data = new DebugData(debugString, source, color, size, drawKeyCode);

        if (!isAttachedToObject)
        {
            debugDataSet.Add(data);
        }
        else
        {
            dynamicDebugDataSet.Add(data);
        }

        return(data);
    }
Exemplo n.º 16
0
 private static void IncGoodBranchCount(DebugData debugData)
 {
     if (debugData != null)
     {
         debugData.GoodBranchCount++;
     }
 }
        public void WolfEncounterTest()
        {
            var TM     = new TravelMaster();
            var wolves = DebugData.GetMistWolfEncounter();

            TM.ChooseOption(wolves, 0);
        }
Exemplo n.º 18
0
    public static void Init()
    {
        debugDataDic.Clear();

        //1.遍历运行程序集下的所有类
        Type[] types = Assembly.GetExecutingAssembly().GetTypes();
        //2.看是否包含这个特性,如果有就获取了这个类型
        foreach (var type in types)
        {
            if (type.IsDefined(typeof(CheatableAttribute), false))
            {
                PropertyInfo[] propertyinfos = type.GetProperties();
                foreach (var item in propertyinfos)
                {
                    if (item.IsDefined(typeof(CheatableAttribute)))
                    {
                        if (item.PropertyType.IsSubclassOf(typeof(PlayerPrefsData)))
                        {
                            string    displayName = item.GetCustomAttribute <CheatableAttribute>().displayName;
                            DebugData debugData   = new DebugData(displayName, item.GetValue(null));
                            debugDataDic.Add(displayName, debugData);
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 19
0
 private static void InternalSafeLog(LogType type, LOG_CHANNEL channel, string message)
 {
     lock (s_Lock)
     {
         DebugData data = new DebugData(channel, message, type);
         m_WaitingList.Add(data);
     }
 }
Exemplo n.º 20
0
 private void SetDebugData(DebugData data)
 {
     debugData = data;
     if (debugGizmo != null)
     {
         debugGizmo.DebugData = data;
     }
 }
Exemplo n.º 21
0
        private MessageMetadata BuildMessageMetadata()
        {
            var debugData = new DebugData("example-test", "1.0.0");

            return(new MessageMetadata(Guid.NewGuid().ToString(), debugData)
            {
                AccountId = _accountId
            });
        }
Exemplo n.º 22
0
 internal InteractiveGenerationContext(List <Segment> segments, Quadtree quadtree, DebugData debugData, PriorityQueue <Segment, int> priorityQueue)
 {
     this.segments        = segments;
     this.quadtree        = quadtree;
     this.debugData       = debugData;
     this.priorityQueue   = priorityQueue;
     globalDerivationStep = 0;
     ended = false;
 }
Exemplo n.º 23
0
    protected override void OnMainControllerAwaken()
    {
        if (DebugData.TestResult)
        {
            DebugData.TestSetResults();
        }

        SetResults();
    }
Exemplo n.º 24
0
        public void BecomeStoneTest()
        {
            var     guy         = DebugData.GetDebugCharacter();
            var     becomeStone = data.GiveAction("Become Stone", guy);
            Outcome outcome     = new Outcome();

            becomeStone.ResolveAction(null, guy, null, null, null, outcome);
            Assert.IsTrue(guy.ArmorCoverage > 5);
        }
Exemplo n.º 25
0
        void ReadData()
        {
            try {
                // Console.WriteLine("Start Read data timer value=" + DiagnosticClass._timer.ElapsedMilliseconds);
                //   _bf = new BinaryFormatter();
                _ms = new MemoryStream();
                byte[] headerBuffer = new byte[headerSize];
                //   Console.WriteLine("Before First read Stream value=" + DiagnosticClass._timer.ElapsedMilliseconds);
                _stream.Read(headerBuffer, 0, headerBuffer.Length);

                string header = Encoding.Default.GetString(headerBuffer);
                Console.WriteLine(header);
                int bufferLenght = int.Parse(header);
                //  Console.WriteLine(bufferLenght);
                byte[] dataBuffer = new byte[bufferLenght];
                //  Console.WriteLine("Before second read Stream value=" + DiagnosticClass._timer.ElapsedMilliseconds);
                _stream.Read(dataBuffer, 0, dataBuffer.Length);

                // _totalSize = headerSize + dataBuffer.Length;
                //foreach (byte b in dataBuffer) {
                //    Console.WriteLine(b);
                //}
                //   Console.WriteLine("Befor Write Stream value=" + DiagnosticClass._timer.ElapsedMilliseconds);
                _ms.Write(dataBuffer, 0, dataBuffer.Length);
                _ms.Position = 0;
                //  Object obj = _bf.Deserialize(_ms);// as TankData;
                //  Message msg= Serializer.Deserialize<Message>(_ms);
                Console.WriteLine(_ms.Length);
                //  Console.WriteLine("Before Serialize Message timer value=" + DiagnosticClass._timer.ElapsedMilliseconds);
                BinaryFormatter bf = new BinaryFormatter();
                bf.Binder = new CustomizedBinder();
                //   bf.Deserialize(_ms);
                var dData = new DebugData();
                dData = bf.Deserialize(_ms) as DebugData;
                Console.WriteLine(dData.logString);
                Console.WriteLine(dData.type);
                //  _message = Serializer.Deserialize<Message>(_ms);
                //  Console.WriteLine(_message._methodParameters._types[1]);
                //  Console.WriteLine("After Serialize Message timer value=" + DiagnosticClass._timer.ElapsedMilliseconds);
                //    ManageMessage(_message);
                // _tankData = _bf.Deserialize(_ms) as TankData;
                // byte[] dataBuffer = new byte[128];
                //  _stream.Read(dataBuffer,0,128);
                _ms.Close();
                // Console.WriteLine(msg._messageType);
                //Console.WriteLine("x={0}, y={1}, z={2}, str={3}",_tankData.x,_tankData.y,_tankData.z,_tankData.a);
                //Console.WriteLine("MessageType={0}, ID={1}, MethodName={2}, TankPosX={3}", _message._messageType,
                //                                                            _message._Id,
                //                                                            _message._methodName,
                //                                                            _message._methodParameters._tankParams.x);
                //  SendData();
            }
            catch (Exception e) {
                Console.WriteLine(e);
            }
        }
        public void ActionSerializationTest()
        {
            var    action  = DebugData.GetDebugAttackAction();
            string json    = JsonConvert.SerializeObject(action);
            var    action2 = JsonConvert.DeserializeObject <Action>(json);

            Assert.AreEqual(action.Name, action2.Name);
            Assert.AreEqual(action.Cost.Count, action2.Cost.Count);
            Assert.AreEqual(action.DeckRecipe.Count, action2.DeckRecipe.Count);
        }
        public void RoundTripSerializationTest()
        {
            var char1 = DebugData.GetDebugCharacter();

            string json = JsonConvert.SerializeObject(char1);

            var char2 = JsonConvert.DeserializeObject <Character>(json);

            Assert.AreEqual(char1.Name, char2.Name);
            Assert.AreEqual(char1.Vitality.Value, char2.Vitality.Value);
        }
Exemplo n.º 28
0
        private void OnDebugDataCollected(DebugData debugData)
        {
            SetVelocityDataLabels(debugData.Car.Velocity);
            SetEngineDataLabels(debugData.Car.Engine);
            SetAeroDataLabels(debugData.Car.Aero);

            SetTyreDataLabels(_leftFrontTyre, debugData.Car.LeftFrontTyre);
            SetTyreDataLabels(_rightFrontTyre, debugData.Car.RightFrontTyre);
            SetTyreDataLabels(_leftRearTyre, debugData.Car.LeftRearTyre);
            SetTyreDataLabels(_rightRearTyre, debugData.Car.RightRearTyre);
        }
Exemplo n.º 29
0
 public void PrintDebugData(DebugData debugData, bool isCsv = false)
 {
     if (isCsv)
     {
         debugData.PrintCsvDebugData(true);
     }
     else
     {
         debugData.PrintDebugData();
     }
 }
Exemplo n.º 30
0
 private void debugDataDelete(object sender, RoutedEventArgs e)
 {
     try
     {
         Button    button = (Button)sender;
         DebugData data   = (DebugData)button.Tag;
         debugData.Remove(data);
     }
     catch (Exception ex)
     {
     }
 }
Exemplo n.º 31
0
 public static int AddMessage(DebugData Msg)
 {
     DebugContainer.Add(Msg);
     CleanLockedDebugMessages();
     return DebugContainer.Count - 1;
 }