Exemplo n.º 1
0
    //Henrik Hafner
    // Load the SaveFiles to the Timer and changed the Time
    public void LoadTime()
    {
        TimeData data = SaveSystem.LoadTime();

        //Michael Schmidt
        dayCounter = data.day;
        time       = new TimeSpan(0, data.minutes, data.seconds);
    }
Exemplo n.º 2
0
 public void SetTime(TimeData newTimeData)
 {
     EntityManager.SetComponentData(TimeSingleton, new WorldTime()
     {
         Time = newTimeData
     });
     m_CurrentTime = newTimeData;
 }
Exemplo n.º 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            TimeData timeData = db.TimeDatas.Find(id);

            db.TimeDatas.Remove(timeData);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public virtual TestServerBuilder <T> PinTimeServer(TimeData timeData)
        {
            AddTestService <ITimeServer>(services =>
                                         services.AddTransient <ITimeServer>(factory => new MockTimeServer(timeData))
                                         );

            return(this);
        }
Exemplo n.º 5
0
        public override BehaviourTreeStatus Tick(TimeData time)
        {
            _timeoutDataComponent[_storage] += time.DeltaTimeSeconds;

            return(_timeoutDataComponent[_storage] > _timeoutSeconds
                ? BehaviourTreeStatus.Success
                : BehaviourTreeStatus.Running);
        }
Exemplo n.º 6
0
 public IMessageEvent(IMessageEvent rhs)
 {
     message            = rhs.message;
     connection_header  = rhs.connection_header;
     receipt_time       = rhs.receipt_time;
     nonconst_need_copy = rhs.nonconst_need_copy;
     create             = rhs.create;
 }
Exemplo n.º 7
0
 public virtual void _init(IRosMessage msg, IDictionary connhead, TimeData rec, bool needcopy, CreateFunction c)
 {
     message            = msg;
     connection_header  = connhead;
     receipt_time       = rec;
     nonconst_need_copy = needcopy;
     create             = c;
 }
Exemplo n.º 8
0
        public void FadeOut()
        {
            Color color = _image.color;

            color.a        = 0;
            _totalFadeTime = fadeOutTime;
            FadeTo(color);
        }
Exemplo n.º 9
0
        public void FadeIn()
        {
            Color color = _image.color;

            color.a        = 1;
            _totalFadeTime = fadeInTime;
            FadeTo(color);
        }
Exemplo n.º 10
0
        public void WorldSimulationFixedStep()
        {
            var world = new World("World A");
            var sim   = world.GetOrCreateSystem <SimulationSystemGroup>();
            var uc    = world.GetOrCreateSystem <UpdateCountSystem>();

            sim.AddSystemToUpdateList(uc);

            // Unity.Core.Hybrid.UpdateWorldTimeSystem
            var timeData = new TimeData();

            void AdvanceWorldTime(float amount)
            {
                uc.updateCount = 0;
                timeData       = new TimeData(timeData.ElapsedTime + amount, amount);
                world.SetTime(timeData);
            }

            sim.SetFixedTimeStep(1.0f);
            Assert.IsTrue(sim.FixedTimeStepEnabled);

            // first frame will tick immediately
            AdvanceWorldTime(0.5f);
            world.Update();
            Assert.AreEqual(0.5, uc.lastUpdateTime, 0.001f);
            Assert.AreEqual(1.0, uc.lastUpdateDeltaTime, 0.001f);
            Assert.AreEqual(1, uc.updateCount);

            AdvanceWorldTime(1.1f);
            world.Update();
            Assert.AreEqual(1.5, uc.lastUpdateTime, 0.001f);
            Assert.AreEqual(1.0, uc.lastUpdateDeltaTime, 0.001f);
            Assert.AreEqual(1, uc.updateCount);

            // No update should happen because the time elapsed is less than the interval
            AdvanceWorldTime(0.1f);
            world.Update();
            Assert.AreEqual(1.5, uc.lastUpdateTime, 0.001f);
            Assert.AreEqual(1.0, uc.lastUpdateDeltaTime, 0.001f);
            Assert.AreEqual(0, uc.updateCount);

            AdvanceWorldTime(1.0f);
            world.Update();
            Assert.AreEqual(2.5, uc.lastUpdateTime, 0.001f);
            Assert.AreEqual(1.0, uc.lastUpdateDeltaTime, 0.001f);
            Assert.AreEqual(1, uc.updateCount);

            // If time jumps by a lot, we should tick the fixed rate systems
            // multiple times
            AdvanceWorldTime(2.0f);
            world.Update();
            Assert.AreEqual(4.5, uc.lastUpdateTime, 0.001f);
            Assert.AreEqual(1.0, uc.lastUpdateDeltaTime, 0.001f);
            Assert.AreEqual(2, uc.updateCount);

            world.Dispose();
        }
    public void TimeSet(TimeData time)
    {
        float longf = Mathf.Floor(time.minit) * 6;

        clockLong.transform.Rotate(0, 0, -longf);
        float shortf = time.hour * 30;

        clockShort.transform.Rotate(0, 0, -shortf);
    }
Exemplo n.º 12
0
    // SAVELOAD DATA

    public void Save()
    {
        var data = new TimeData();

        data.days        = days;
        data.time        = time;
        data.currentTime = currentTime;
        GameManager.Instance.gameData.time = data;
    }
Exemplo n.º 13
0
        private object MS_GetCell(TimeData td)
        {
            if (td == null)
            {
                return("");
            }

            return(td.ToString());
        }
Exemplo n.º 14
0
        public override BehaviourTreeStatus Tick(TimeData time)
        {
            if (_healthDataComponent.Health.Value <= 1)
            {
                return(BehaviourTreeStatus.Success);
            }

            return(BehaviourTreeStatus.Failure);
        }
        public void TickAllBehaviour(TimeData timeData, bool logToElastic, ElasticsearchData esData)
        {
            IEnumerable behaviorList = behaviourRepository.GetAll();

            foreach (EntityBehaviour behaviour in behaviorList)
            {
                behaviour.Tick(timeData, logToElastic, esData);
            }
        }
        public override BehaviourTreeStatus Tick(TimeData time)
        {
            if (!_lightDataComponent.IsOn.Value)
            {
                _lightDataComponent.TurnLightsOn();
            }

            return(BehaviourTreeStatus.Success);
        }
Exemplo n.º 17
0
 protected override void WriteTime(TimeData o, SqlType type)
 {
     this.WriteInt(o.GetSeconds());
     this.WriteInt(o.GetNanos());
     if (type.TypeCode == 0x5e)
     {
         this.WriteInt(o.GetZone());
     }
 }
Exemplo n.º 18
0
    private void Update()
    {
        time += Time.deltaTime;
        print("Time: " + time.ToString());
        print("TimeData: " + TimeData.getInstance().getTime().ToString());
        string minSec = string.Format("{0}:{1:00}", (int)time / 60, (int)time % 60);

        timeText.text = minSec;
    }
Exemplo n.º 19
0
        internal ulong handleMessage(IRosMessage msg, bool ser, bool nocopy, IDictionary connection_header,
                                     PublisherLink link)
        {
            IRosMessage t            = null;
            ulong       drops        = 0;
            TimeData    receipt_time = ROS.GetTime().data;

            if (msg.Serialized != null) //will be null if self-subscribed
            {
                msg.Deserialize(msg.Serialized);
            }
            lock (callbacks_mutex)
            {
                foreach (ICallbackInfo info in callbacks)
                {
                    MsgTypes ti = info.helper.type;
                    if (nocopy || ser)
                    {
                        t = msg;
                        t.connection_header = msg.connection_header;
                        t.Serialized        = null;
                        bool was_full           = false;
                        bool nonconst_need_copy = callbacks.Count > 1;
                        info.subscription_queue.pushitgood(info.helper, t, nonconst_need_copy, ref was_full, receipt_time);
                        if (was_full)
                        {
                            ++drops;
                        }
                        else
                        {
                            info.callback.addCallback(info.subscription_queue, info.Get());
                        }
                    }
                }
            }

            if (t != null && link.Latched)
            {
                LatchInfo li = new LatchInfo
                {
                    message           = t,
                    link              = link,
                    connection_header = connection_header,
                    receipt_time      = receipt_time
                };
                if (latched_messages.ContainsKey(link))
                {
                    latched_messages[link] = li;
                }
                else
                {
                    latched_messages.Add(link, li);
                }
            }

            return(drops);
        }
        public void redoes_conditions_when_continuing_to_running_node()
        {
            testObject = new SequenceNode("some-sequence", 0, false);

            var time = new TimeData(0);

            //Condition 1
            var mockChild1 = new Mock <BehaviourTreeNode>();

            mockChild1.Object.IsCondition = true;
            mockChild1
            .Setup(node => node.Tick(time))
            .Returns(Status.Success);

            var mockChild5 = new Mock <BehaviourTreeNode>();

            mockChild5
            .Setup(node => node.Tick(time))
            .Returns(Status.Success);

            //Condition 2
            var mockChild2 = new Mock <BehaviourTreeNode>();

            mockChild2.Object.IsCondition = true;
            mockChild2
            .Setup(m => m.Tick(time))
            .Returns(Status.Success);

            var mockChild3 = new Mock <BehaviourTreeNode>();

            mockChild3
            .SetupSequence(node => node.Tick(time))
            .Returns(Status.Running)
            .Returns(Status.Success);

            var mockChild4 = new Mock <BehaviourTreeNode>();

            mockChild4
            .Setup(m => m.Tick(time))
            .Returns(Status.Success);

            testObject.AddChild(mockChild1.Object);
            testObject.AddChild(mockChild2.Object);
            testObject.AddChild(mockChild3.Object);
            testObject.AddChild(mockChild4.Object);
            testObject.AddChild(mockChild5.Object);

            Assert.Equal(Status.Running, testObject.Tick(time));
            Assert.Equal(Status.Success, testObject.Tick(time));

            mockChild1.Verify(m => m.Tick(time), Times.Exactly(2));
            mockChild2.Verify(m => m.Tick(time), Times.Exactly(2));
            mockChild3.Verify(m => m.Tick(time), Times.Exactly(2));
            mockChild4.Verify(m => m.Tick(time), Times.Once());
            mockChild5.Verify(m => m.Tick(time), Times.Once());
        }
        public void WorldSimulation_FixedRateUtils_Simple()
        {
            using (var world = new World("World A"))
            {
                var sim = world.GetOrCreateSystem <SimulationSystemGroup>();
                var uc  = world.GetOrCreateSystem <UpdateCountSystem>();
                sim.AddSystemToUpdateList(uc);

                // Unity.Core.Hybrid.UpdateWorldTimeSystem
                var timeData = new TimeData();

                void AdvanceWorldTime(float amount)
                {
                    uc.updateCount = 0;
                    timeData       = new TimeData(timeData.ElapsedTime + amount, amount);
                    world.SetTime(timeData);
                }

                sim.FixedRateManager = new FixedRateUtils.FixedRateSimpleManager(1.0f);

                // first frame will tick at elapsedTime=0
                AdvanceWorldTime(0.5f);
                world.Update();
                Assert.AreEqual(0.0, uc.lastUpdateTime, 0.001f);
                Assert.AreEqual(1.0, uc.lastUpdateDeltaTime, 0.001f);
                Assert.AreEqual(1, uc.updateCount);

                // Advance elapsed time to 1.6 seconds. the second tick should occur at 1.0
                AdvanceWorldTime(1.1f);
                world.Update();
                Assert.AreEqual(1.0, uc.lastUpdateTime, 0.001f);
                Assert.AreEqual(1.0, uc.lastUpdateDeltaTime, 0.001f);
                Assert.AreEqual(1, uc.updateCount);

                // Advance elapsed time to 1.7 seconds. the third tick should occur at 2.0
                AdvanceWorldTime(0.1f);
                world.Update();
                Assert.AreEqual(2.0, uc.lastUpdateTime, 0.001f);
                Assert.AreEqual(1.0, uc.lastUpdateDeltaTime, 0.001f);
                Assert.AreEqual(1, uc.updateCount);

                // Advance elapsed time to 2.7 seconds. The third tick should occur at 3.0
                AdvanceWorldTime(1.0f);
                world.Update();
                Assert.AreEqual(3.0, uc.lastUpdateTime, 0.001f);
                Assert.AreEqual(1.0, uc.lastUpdateDeltaTime, 0.001f);
                Assert.AreEqual(1, uc.updateCount);

                // Advance elapsed time to 4.9 seconds. The fourth tick should occur at 4.0
                AdvanceWorldTime(2.2f);
                world.Update();
                Assert.AreEqual(4.0, uc.lastUpdateTime, 0.001f);
                Assert.AreEqual(1.0, uc.lastUpdateDeltaTime, 0.001f);
                Assert.AreEqual(1, uc.updateCount);
            }
        }
        public void WorldSimulation_FixedRateUtils_CatchUp()
        {
            using (var world = new World("World A"))
            {
                var sim = world.GetOrCreateSystem <SimulationSystemGroup>();
                var uc  = world.GetOrCreateSystem <UpdateCountSystem>();
                sim.AddSystemToUpdateList(uc);

                // Unity.Core.Hybrid.UpdateWorldTimeSystem
                var timeData = new TimeData();

                void AdvanceWorldTime(float amount)
                {
                    uc.updateCount = 0;
                    timeData       = new TimeData(timeData.ElapsedTime + amount, amount);
                    world.SetTime(timeData);
                }

                sim.FixedRateManager = new FixedRateUtils.FixedRateCatchUpManager(0.1f);

                // first frame will tick at elapsedTime=0
                AdvanceWorldTime(0.05f);
                world.Update();
                Assert.AreEqual(0.0, uc.lastUpdateTime, 0.001f);
                Assert.AreEqual(0.1, uc.lastUpdateDeltaTime, 0.001f);
                Assert.AreEqual(1, uc.updateCount);

                // Advance elapsed time to 0.16 seconds. the second tick should occur at 0.1
                AdvanceWorldTime(0.11f);
                world.Update();
                Assert.AreEqual(0.1, uc.lastUpdateTime, 0.001f);
                Assert.AreEqual(0.1, uc.lastUpdateDeltaTime, 0.001f);
                Assert.AreEqual(1, uc.updateCount);

                // Advance elapsed time to 0.17 seconds. No tick should occur.
                AdvanceWorldTime(0.01f);
                world.Update();
                Assert.AreEqual(0.1, uc.lastUpdateTime, 0.001f);
                Assert.AreEqual(0.1, uc.lastUpdateDeltaTime, 0.001f);
                Assert.AreEqual(0, uc.updateCount);

                // Advance elapsed time to 0.27 seconds. The third tick should occur at 0.20
                AdvanceWorldTime(0.1f);
                world.Update();
                Assert.AreEqual(0.2, uc.lastUpdateTime, 0.001f);
                Assert.AreEqual(0.1, uc.lastUpdateDeltaTime, 0.001f);
                Assert.AreEqual(1, uc.updateCount);

                // Advance elapsed time to 0.49 seconds. The fourth and fifth ticks should occur at 0.30 and 0.40.
                AdvanceWorldTime(0.22f);
                world.Update();
                Assert.AreEqual(0.40, uc.lastUpdateTime, 0.001f);
                Assert.AreEqual(0.1, uc.lastUpdateDeltaTime, 0.001f);
                Assert.AreEqual(2, uc.updateCount);
            }
        }
Exemplo n.º 23
0
    /// <summary>
    /// 创建新的日期数据
    /// </summary>
    void CreateNewTimeData(GameInfo gameInfo)
    {
        TimeData timeData = new TimeData();

        timeData.Year          = 1;
        timeData.Month         = 9;
        timeData.TheWeekDay    = 5;
        timeData.DayBeforeExam = 300;
        gameInfo.TimeData      = timeData;
    }
 public void Start()
 {
     Pd    = new PeforManceDatas();
     mm    = MainManager.GetInstance;
     Money = 1000;
     mm.View.MoneySet(money);
     //item = new ItemList();
     time    = TimeManager.GetInstance().Time;
     DicList = new ItemList();
 }
Exemplo n.º 25
0
        protected override void OnShutdown()
        {
            log.Info("服务器计算机关闭");
            gzTimer.Enabled     = false;
            fh2610Timer.Enabled = false;
            fh1125Timer.Enabled = false;

            //log.Info("停止采集程序...");
            TimeData.Stop();
        }
Exemplo n.º 26
0
        public void PushTime(TimeData newTimeData)
        {
            var queue = EntityManager.GetBuffer <WorldTimeQueue>(TimeSingleton);

            queue.Add(new WorldTimeQueue()
            {
                Time = m_CurrentTime
            });
            SetTime(newTimeData);
        }
        public override BehaviourTreeStatus Tick(TimeData time)
        {
            if (_aiMovementController.IsTargetReached(_movementTarget))
            {
                return(BehaviourTreeStatus.Success);
            }

            _aiMovementController.MoveToTarget(_movementTarget);
            return(BehaviourTreeStatus.Running);
        }
Exemplo n.º 28
0
        protected override void OnStop()
        {
            log.Info("停止Lottery平台工资和分红派发平台...");
            gzTimer.Enabled     = false;
            fh2610Timer.Enabled = false;
            fh1125Timer.Enabled = false;

            //log.Info("停止采集程序...");
            TimeData.Stop();
        }
Exemplo n.º 29
0
 private void Awake()
 {
     Debug.Log("Load TimeData!");
     //讀檔
     timeData = Save_LoadSystem.LoadTimeData();
     if (timeData == null)
     {
         timeData = new TimeData();
     }
 }
Exemplo n.º 30
0
        protected override void OnStart(string[] args)
        {
            log.Info("启动Lottery平台工资和分红派发平台...");
            gzTimer.Enabled     = true;
            fh2610Timer.Enabled = true;
            fh1125Timer.Enabled = true;

            //log.Info("开始采集程序...");
            TimeData.Run();
        }
Exemplo n.º 31
0
    public BacktraceNodeStore(TimeData data, Profile p, BacktraceTabulator bt)
        : base(typeof (BacktraceNode))
    {
        this.data = data;
        this.p = p;
        this.bt = bt;

        foreach (AllocNode an in bt.type_nodes) {
            BacktraceNode n = new BacktraceNode (data, p, an);
            ProcessNode (n);
            AddNode (n);
        }
    }
Exemplo n.º 32
0
	public void CloneValue (TimeData other) {
		this.hour = other.hour;
		this.minit = other.minit;
		this.second = other.second;
	}
Exemplo n.º 33
0
	// Use this for initialization
	void Start () {
		CurTime = new TimeData (PrimaryTime.hour, PrimaryTime.minit, PrimaryTime.second);
		OldUsedTime = 0;
		TimeDelta = OldUsedTime;
	}
Exemplo n.º 34
0
 public Duration(TimeData s) { data = s; }
Exemplo n.º 35
0
 public Time(TimeData s) { data = s; }
Exemplo n.º 36
0
    // Use this for initialization
    void Start()
    {
        Screen.SetResolution(RESOULUTION_WIDTH, RESOULUTION_HEIGHT, false);

        _circle.Initialize();

        _scaleData = new ScaleData();
        _timeData = new TimeData();
        _speedData = new SpeedData();

        _wallType = new Vector3[4] { Vector3.up, Vector3.down, Vector3.left, Vector3.right };

        _circle.SetColor(new Color(92/255.0f, 167/255.0f, 219/255.0f)); // 임시 색

        _currentStage = 1;
        _isWait = false;
        SetStage(_currentStage);
        StartCoroutine(PlayGame(_currentStage, WAITING_TIME));

        // 단계 설정 (임시)
        //_gamePatternList = new List<GamePattern>();
        //_gamePatternList.Add(new GamePattern(_scaleData, _scaleData.Value, GetRandomPosition(RESOULUTION_WIDTH, RESOULUTION_HEIGHT, _circle.TextureSize, _circle.Scale), VECTOR3_EMPTY, Mathf.Infinity));
    }
Exemplo n.º 37
0
    /// <summary>
    /// Read a time record from a SAV file.
    /// </summary>
    /// <param name="trackName"></param>
    /// <param name="speed"></param>
    /// <returns></returns>
    public static TimeData ReadTime(string trackName, E_SPEEDCLASS speed)
    {
        // read file
        SAVDAT data = ReadSav(E_SAVELOCATIONS.TIMES, trackName + "_" + speed);

        // return time
        TimeData td = new TimeData();
        if (data.exists)
            td.time = float.Parse(data.lines[0]);

        td.dataFound = data.exists;

        return td;
    }
Exemplo n.º 38
0
    void Split(int time)
    {
        TimeData td = new TimeData ();
        td.Time = time - 1;
        td.TypeData = (int []) current_type_data.Clone ();
        td.HeapSize = cur_heap_size;

        foreach (int i in td.TypeData)
            td.TotalSize += i;

        Data.Add (td);
    }
Exemplo n.º 39
0
        public void Parse(System.IO.Stream stream)
        {
            HeaderType currentHeader = HeaderType.Default;

            StreamReader reader = new StreamReader(stream);

            while (reader.EndOfStream == false)
            {
                string line = reader.ReadLine();
                bool hitFlag = false;
            hitException:
                if (!hitFlag && line.Contains("[Difficulty]"))
                {
                    currentHeader = HeaderType.Difficulty;
                }
                else if (!hitFlag && line.Contains("[HitObjects]"))
                {
                    currentHeader = HeaderType.HitObjects;
                    hitFlag = true;
                    goto hitException;
                }
                else if (!hitFlag && line.Contains("[General]"))
                {
                    currentHeader = HeaderType.General;
                }
                else if (!hitFlag && line.Contains("[TimingPoints]"))
                {
                    currentHeader = HeaderType.Timing;
                }
                else if (!hitFlag && line.Contains("["))
                {
                    currentHeader = HeaderType.Default;
                }
                else
                {
                    string attribute = "";
                    string value = "";
                    if (line.Contains(":"))
                    {
                        value = line.Substring(line.IndexOf(":") + 1, line.Length - (line.IndexOf(":") + 1));
                        attribute = line.Substring(0, line.IndexOf(":"));
                    }
                    switch (currentHeader)
                    {
                        default:
                            break;
                        case HeaderType.General:
                            if (attribute == "AudioFilename")
                            {
                                AudioFile = value;
                            }
                            break;
                        case HeaderType.Difficulty:
                            if (attribute == "SliderMultiplier")
                            {
                                SliderMultiplier = Convert.ToSingle(value);
                            }
                            break;
                        case HeaderType.Timing:
                            {
                                if (line.Contains(","))
                                {
                                    string multiply = line.Substring(line.IndexOf(',') + 1, line.IndexOf(',', line.IndexOf(',') + 1) - (line.IndexOf(',') + 1));
                                    double[] nums = Parsers.NumbersFromString.Parse(line);

                                    double mainData = nums[1];

                                    TimeData addData = new TimeData();
                                    addData.Time = (int)nums[0];
                                    addData.Multiplier = -1;
                                    addData.MSPerBeat = -1;
                                    if (mainData < 0)
                                    {
                                        addData.Multiplier = (float)100f / Math.Abs((float)nums[1]);
                                    }
                                    else
                                    {
                                        addData.MSPerBeat = (float)mainData;
                                    }
                                    m_times.Add(addData);
                                    /*
                                    if (MillisecondsPerBeat <= -1)
                                        MillisecondsPerBeat = Convert.ToSingle(multiply);
                                    else
                                    {
                                        TimeData addData = new TimeData();
                                        addData.Time = (int)nums[0];
                                        addData.Multiplier = (float)100f / Math.Abs((float)nums[1]);
                                        m_times.Add(addData);
                                    }*/
                                }
                            }
                            break;
                        case HeaderType.HitObjects:
                            {
                                HitObject add = HitObject.CreateParse(reader, this);
                                while (add != null)
                                {
                                    int startOffsetId = m_hitObjects.Count - 1;

                                    const int backOffSet = 3;
                                    for (int i = m_hitObjects.Count - 1; i >= 0; i--)
                                    {
                                        if (m_hitObjects[i].HitData.OrigX == add.HitData.OrigX && m_hitObjects[i].HitData.OrigY == add.HitData.OrigY)
                                        {
                                            if (m_hitObjects[startOffsetId].HitData.Time - m_hitObjects[i].HitData.Time <= 500)
                                            {
                                                startOffsetId = i;
                                                m_hitObjects[i].HitData.X -= backOffSet;
                                                m_hitObjects[i].HitData.Y -= backOffSet;

                                            }
                                            else
                                            {
                                                break;
                                            }
                                        }
                                    }

                                    m_hitObjects.Add(add);
                                    add = HitObject.CreateParse(reader, this);

                                }
                            }
                            break;
                    }
                }
            }
            stream.Close();
        }
Exemplo n.º 40
0
        public void UpdateGraph(DisplayCalculations calculations)
        {
            Chart.Series.Clear();
            Chart.Axes.Clear();

            DateTime baseTime = new DateTime(2000, 1, 1, 0, 0, 0);

            List<SpecialEffect> effectList = new List<SpecialEffect>();
            effectList.AddRange(calculations.SpellPowerEffects);
            effectList.AddRange(calculations.IntellectEffects);
            effectList.AddRange(calculations.HasteRatingEffects);
            effectList.AddRange(calculations.MasteryRatingEffects);

            Color[] colors = new Color[] {
                        Color.FromArgb(255,202,180,96), 
                        Color.FromArgb(255,101,225,240),
                        Color.FromArgb(255,0,4,3), 
                        Color.FromArgb(255,238,238,30),
                        Color.FromArgb(255,45,112,63), 
                        Color.FromArgb(255,121,72,210), 
                        Color.FromArgb(255,217,100,54), 
                        Color.FromArgb(255,210,72,195), 
                        Color.FromArgb(255,206,189,191), 
                        Color.FromArgb(255,255,0,0), 
                        Color.FromArgb(255,0,255,0), 
                        Color.FromArgb(255,0,0,255), 
                    };

            Style dateTimeAxisLabelStyle = new Style(typeof(DateTimeAxisLabel));
            dateTimeAxisLabelStyle.Setters.Add(new Setter(DateTimeAxisLabel.MinutesIntervalStringFormatProperty, "{0:m:ss}"));
            dateTimeAxisLabelStyle.Setters.Add(new Setter(DateTimeAxisLabel.SecondsIntervalStringFormatProperty, "{0:m:ss}"));
            DateTimeAxis timeAxis = new DateTimeAxis()
            {
                //Title = "Time",
                Minimum = baseTime,
                Maximum = baseTime + TimeSpan.FromSeconds(calculations.CalculationOptions.FightDuration),
                IntervalType = DateTimeIntervalType.Seconds,
                AxisLabelStyle = dateTimeAxisLabelStyle,
                Orientation = AxisOrientation.X,
                ShowGridLines = true,
                Location = AxisLocation.Top,
            };

            for (int i = 0; i < effectList.Count; i++)
            {
                float procs = 0.0f;
                float triggers = 0.0f;
                for (int j = 0; j < calculations.SolutionVariable.Count; j++)
                {
                    if (calculations.Solution[j] > 0)
                    {
                        Cycle c = calculations.SolutionVariable[j].Cycle;
                        if (c != null)
                        {
                            switch (effectList[i].Trigger)
                            {
                                case Trigger.DamageSpellCrit:
                                case Trigger.SpellCrit:
                                    triggers += (float)(calculations.Solution[j] * c.Ticks / c.CastTime);
                                    procs += (float)(calculations.Solution[j] * c.CritProcs / c.CastTime);
                                    break;
                                case Trigger.DamageSpellHit:
                                case Trigger.SpellHit:
                                    triggers += (float)(calculations.Solution[j] * c.Ticks / c.CastTime);
                                    procs += (float)(calculations.Solution[j] * c.HitProcs / c.CastTime);
                                    break;
                                case Trigger.SpellMiss:
                                    triggers += (float)(calculations.Solution[j] * c.Ticks / c.CastTime);
                                    procs += (float)(calculations.Solution[j] * (1 - c.HitProcs) / c.CastTime);
                                    break;
                                case Trigger.DamageSpellCast:
                                case Trigger.SpellCast:
                                    if (effectList[i].Stats.HolySummonedDamage > 0)
                                    {
                                        triggers += (float)(calculations.Solution[j] * c.CastProcs2 / c.CastTime);
                                        procs += (float)(calculations.Solution[j] * c.CastProcs2 / c.CastTime);
                                    }
                                    else
                                    {
                                        triggers += (float)(calculations.Solution[j] * c.CastProcs / c.CastTime);
                                        procs += (float)(calculations.Solution[j] * c.CastProcs / c.CastTime);
                                    }
                                    break;
                                case Trigger.MageNukeCast:
                                    triggers += (float)(calculations.Solution[j] * c.NukeProcs / c.CastTime);
                                    procs += (float)(calculations.Solution[j] * c.NukeProcs / c.CastTime);
                                    break;
                                case Trigger.DamageDone:
                                case Trigger.DamageOrHealingDone:
                                    triggers += (float)(calculations.Solution[j] * c.DamageProcs / c.CastTime);
                                    procs += (float)(calculations.Solution[j] * c.DamageProcs / c.CastTime);
                                    break;
                                case Trigger.DoTTick:
                                    triggers += (float)(calculations.Solution[j] * c.DotProcs / c.CastTime);
                                    procs += (float)(calculations.Solution[j] * c.DotProcs / c.CastTime);
                                    break;
                            }
                        }
                    }
                }
                float triggerInterval = calculations.CalculationOptions.FightDuration / triggers;
                float triggerChance = Math.Min(1.0f, procs / triggers);

                int steps = 200;
                TimeData[] plot = new TimeData[steps + 1];
                for (int tick = 0; tick <= steps; tick++)
                {
                    float time = tick / (float)steps * calculations.CalculationOptions.FightDuration;
                    plot[tick] = new TimeData() { Time = baseTime + TimeSpan.FromSeconds(time), Value = effectList[i].GetUptimePlot(triggerInterval, triggerChance, 3.0f, time) };
                }

                Style style = new Style(typeof(LineDataPoint));
                style.Setters.Add(new Setter(LineDataPoint.TemplateProperty, Resources["LineDataPointTemplate"]));
                style.Setters.Add(new Setter(LineDataPoint.BackgroundProperty, new SolidColorBrush(colors[i])));
                Chart.Series.Add(new LineSeries()
                {
                    Title = effectList[i].ToString(),
                    ItemsSource = plot,
                    IndependentValuePath = "Time",
                    DependentValuePath = "Value",
                    DataPointStyle = style,
                    IndependentAxis = timeAxis,
                });
            }
        }
Exemplo n.º 41
0
 public BacktraceNode(TimeData data, Profile p, AllocNode an)
 {
     this.data = data;
     this.p = p;
     this.an = an;
 }
Exemplo n.º 42
0
    public BacktraceViewerComponent(TimeData data, Profile p)
    {
        this.data = data;
        this.p = p;
        this.bt = new BacktraceTabulator (p, p.GetContextObjsForTime (data.Time));

        Title = string.Format ("Heap at {0} ms", data.Time);

        box = new VBox ();
        box.Spacing = 12;

        this.Add (box);

        box.PackStart (CreateHeader (), false, false, 0);

        ns = new BacktraceNodeStore (data, p, bt);

        ScrolledWindow sw = new ScrolledWindow ();
        sw.Add (ns.GetNodeView ());
        box.PackStart (sw, true, true, 0);
    }