Beispiel #1
0
 public override void Awake()
 {
     base.Awake();
     _rigid = GetComponent <Rigidbody2D>();
     _stat  = GetComponent <GeneralStatistics>();
     _anim  = GetComponentInChildren <Animator>();
 }
Beispiel #2
0
 private void Awake()
 {
     _scriptableRefHolder = GetComponent <SkriptableReferenceHolder>();
     _stat        = GetComponent <GeneralStatistics>();
     _cEffects    = GetComponentInChildren <CharacterEffects>();
     _buffHandler = GetComponentInChildren <BuffHandler>();
 }
Beispiel #3
0
        public void Refresh()
        {
            GeneralStatistics.Clear();
            TracksByArtist.Clear();
            AlbumsByReleaseType.Clear();
            ArtistsByGrouping.Clear();

            GeneralStatistics.Add(new Statistic("Track Artists", _service.GetNumberOfTrackArtists()));
            GeneralStatistics.Add(new Statistic("Album Artists", _service.GetNumberOfAlbumArtists()));
            GeneralStatistics.Add(new Statistic("Albums", _service.GetNumberOfAlbums()));
            GeneralStatistics.Add(new Statistic("Tracks", _service.GetNumberOfTracks()));
            GeneralStatistics.Add(new Statistic("Total Time", _service.GetTotalTime()));

            _service.GetTracksByArtist(10)
            .Select(a => new Statistic(a.Item1, a.Item2))
            .ToList()
            .ForEach(TracksByArtist.Add);

            _service.GetAlbumsByReleaseType()
            .Select(a => new Statistic(a.Item1.GetDisplayName(), a.Item2))
            .ToList()
            .ForEach(AlbumsByReleaseType.Add);

            _service.GetArtistsByGrouping()
            .Select(a => new Statistic(a.Item1, a.Item2))
            .ToList()
            .ForEach(ArtistsByGrouping.Add);
        }
Beispiel #4
0
 private void Awake()
 {
     _stat = GetComponent <GeneralStatistics>();
     if (Visualize)
     {
         BuffPrefab.SetActive(false);
     }
 }
Beispiel #5
0
 public override void Awake()
 {
     base.Awake();
     _anim   = GetComponentInChildren <Animator>();
     _rigid  = GetComponent <Rigidbody2D>();
     _bh     = GetComponent <BehaviourController>();
     _sensor = GetComponentInChildren <EnemySensor>();
     _stat   = GetComponent <GeneralStatistics>();
 }
Beispiel #6
0
        public static GeneralStatistics GetGeneralStatistics(StatisticsQueryFlags queryFlags)
        {
            GeneralStatistics stat = new GeneralStatistics();

            stat.QueryFlags = queryFlags;

            if ((queryFlags & StatisticsQueryFlags.Connections) != 0)
            {
                int connections = 0;
                foreach (var conn in HTTPManager.Connections)
                {
                    if (conn.Value != null)
                    {
                        connections += conn.Value.Count;
                    }
                }

#if !BESTHTTP_DISABLE_WEBSOCKET && UNITY_WEBGL && !UNITY_EDITOR
                connections += WebSocket.WebSocket.WebSockets.Count;
#endif

                stat.Connections       = connections;
                stat.ActiveConnections = ActiveConnections.Count
#if !BESTHTTP_DISABLE_WEBSOCKET && UNITY_WEBGL && !UNITY_EDITOR
                                         + WebSocket.WebSocket.WebSockets.Count
#endif
                ;
                stat.FreeConnections     = FreeConnections.Count;
                stat.RecycledConnections = RecycledConnections.Count;
                stat.RequestsInQueue     = RequestQueue.Count;
            }

#if !BESTHTTP_DISABLE_CACHING && (!UNITY_WEBGL || UNITY_EDITOR)
            if ((queryFlags & StatisticsQueryFlags.Cache) != 0)
            {
                stat.CacheEntityCount = HTTPCacheService.GetCacheEntityCount();
                stat.CacheSize        = HTTPCacheService.GetCacheSize();
            }
#endif

#if !BESTHTTP_DISABLE_COOKIES && (!UNITY_WEBGL || UNITY_EDITOR)
            if ((queryFlags & StatisticsQueryFlags.Cookies) != 0)
            {
                List <Cookies.Cookie> cookies = Cookies.CookieJar.GetAll();
                stat.CookieCount = cookies.Count;
                uint cookiesSize = 0;
                for (int i = 0; i < cookies.Count; ++i)
                {
                    cookiesSize += cookies[i].GuessSize();
                }
                stat.CookieJarSize = cookiesSize;
            }
#endif

            return(stat);
        }
Beispiel #7
0
    private void Focus(GeneralStatistics newStat)
    {
        CurrentFocusedCharacter = newStat;
        TargetPanel.SetActive(true);
        LockMarker.SetActive(true);

        CancelInvoke();

        if (!_lock)
        {
            Invoke("LoseFocus", AutoLostFocus);
        }
    }
Beispiel #8
0
        public CSVBuilder(StreamWriter sw, string delimiter, ParsedLog log, string[] uploadresult)
        {
            _log       = log;
            _sw        = sw;
            _delimiter = delimiter;
            _phases    = log.FightData.GetPhases(log);

            _statistics = log.Statistics;

            _uploadResult = uploadresult ?? new string[] { "", "", "" };
            _legacyTarget = log.FightData.Logic.GetLegacyTarget();
            if (_legacyTarget == null)
            {
                throw new InvalidDataException("Error Encountered: No Targets found for csv");
            }
        }
        public CSVBuilder(StreamWriter sw, string delimiter, ParsedLog log, string[] uploadresult)
        {
            _log           = log;
            _sw            = sw;
            _delimiter     = delimiter;
            _phases        = log.FightData.GetPhases(log);
            _noFakePlayers = log.PlayerList.Where(x => !x.IsFakeActor).ToList();

            _statistics = log.Statistics;

            _uploadResult = uploadresult ?? new string[] { "", "", "" };
            _legacyTarget = log.FightData.Logic.GetLegacyTarget();
            if (_legacyTarget == null)
            {
                throw new InvalidDataException("No Targets found for csv");
            }
        }
Beispiel #10
0
        public static GeneralStatistics GetGeneralStatistics(StatisticsQueryFlags queryFlags)
        {
            GeneralStatistics stat = new GeneralStatistics();

            stat.QueryFlags = queryFlags;

            if ((queryFlags & StatisticsQueryFlags.Connections) != 0)
            {
                int connections = 0;
                foreach (var conn in HTTPManager.Connections)
                {
                    if (conn.Value != null)
                    {
                        connections += conn.Value.Count;
                    }
                }

                stat.Connections         = connections;
                stat.ActiveConnections   = ActiveConnections.Count;
                stat.FreeConnections     = FreeConnections.Count;
                stat.RecycledConnections = RecycledConnections.Count;
                stat.RequestsInQueue     = RequestQueue.Count;
            }

            if ((queryFlags & StatisticsQueryFlags.Cache) != 0)
            {
                stat.CacheEntityCount = HTTPCacheService.GetCacheEntityCount();
                stat.CacheSize        = HTTPCacheService.GetCacheSize();
            }

            if ((queryFlags & StatisticsQueryFlags.Cookies) != 0)
            {
                List <Cookies.Cookie> cookies = Cookies.CookieJar.GetAll();
                stat.CookieCount = cookies.Count;
                uint cookiesSize = 0;
                for (int i = 0; i < cookies.Count; ++i)
                {
                    cookiesSize += cookies [i].GuessSize();
                }
                stat.CookieJarSize = cookiesSize;
            }

            return(stat);
        }
        public CSVBuilder(ParsedEvtcLog log, CSVSettings settings, string[] uploadresult = null)
        {
            if (settings == null)
            {
                throw new InvalidDataException("Missing settings in CSVBuilder");
            }
            _log           = log;
            _delimiter     = settings.Delimiter;
            _phases        = log.FightData.GetPhases(log);
            _noFakePlayers = log.PlayerList.Where(x => !x.IsFakeActor).ToList();

            _statistics = log.Statistics;

            _uploadResult = uploadresult ?? new string[] { "", "", "" };
            _legacyTarget = log.FightData.Logic.GetLegacyTarget();
            if (_legacyTarget == null)
            {
                throw new InvalidDataException("No Targets found for csv");
            }
        }
 public ParsedLog(string buildVersion, FightData fightData, AgentData agentData, SkillData skillData,
                  List <CombatItem> combatItems, List <Player> playerList, long evtcLogDuration, ParserSettings parserSettings)
 {
     FightData      = fightData;
     AgentData      = agentData;
     SkillData      = skillData;
     PlayerList     = playerList;
     ParserSettings = parserSettings;
     //
     PlayerListBySpec = playerList.GroupBy(x => x.Prof).ToDictionary(x => x.Key, x => x.ToList());
     PlayerAgents     = new HashSet <AgentItem>(playerList.Select(x => x.AgentItem));
     CombatData       = new CombatData(combatItems, FightData, AgentData, SkillData, playerList);
     LogData          = new LogData(buildVersion, CombatData, evtcLogDuration);
     //
     UpdateFightData();
     //
     Buffs           = new BuffsContainer(LogData.GW2Version);
     DamageModifiers = new DamageModifiersContainer(LogData.GW2Version);
     MechanicData    = FightData.Logic.GetMechanicData();
     Statistics      = new GeneralStatistics(CombatData, PlayerList, Buffs);
 }
Beispiel #13
0
    private void FindTarget()
    {
        RaycastHit2D hit = Physics2D.Raycast(new Vector2(Camera.ScreenToWorldPoint(Input.mousePosition).x, Camera.ScreenToWorldPoint(Input.mousePosition).y), Vector2.zero, 0f, TargetLayer);

        if (hit)
        {
            GeneralStatistics newStat = hit.transform.gameObject.GetComponentInParent <GeneralStatistics>();
            if (newStat)
            {
                if (Input.GetMouseButtonDown(0))
                {
                    _lock = true;
                    Focus(newStat);
                }
                else if (!_lock)
                {
                    Focus(newStat);
                }
            }
        }
    }
Beispiel #14
0
 public ParsedLog(string buildVersion, FightData fightData, AgentData agentData, SkillData skillData,
                  List <CombatItem> combatItems, List <Player> playerList, long evtcLogDuration, ParserSettings parserSettings, OperationController operation)
 {
     FightData      = fightData;
     AgentData      = agentData;
     SkillData      = skillData;
     PlayerList     = playerList;
     ParserSettings = parserSettings;
     _operation     = operation;
     //
     PlayerListBySpec = playerList.GroupBy(x => x.Prof).ToDictionary(x => x.Key, x => x.ToList());
     PlayerAgents     = new HashSet <AgentItem>(playerList.Select(x => x.AgentItem));
     _operation.UpdateProgressWithCancellationCheck("Creating GW2EI Combat Events");
     CombatData = new CombatData(combatItems, FightData, AgentData, SkillData, playerList);
     _operation.UpdateProgressWithCancellationCheck("Creating GW2EI Log Meta Data");
     LogData = new LogData(buildVersion, CombatData, evtcLogDuration);
     _operation.UpdateProgressWithCancellationCheck("GW2 Build " + LogData.GW2Version);
     //
     _operation.UpdateProgressWithCancellationCheck("Checking Success");
     FightData.Logic.CheckSuccess(CombatData, AgentData, FightData, PlayerAgents);
     if (FightData.FightEnd <= 2200)
     {
         throw new TooShortException();
     }
     if (ParserSettings.SkipFailedTries && !FightData.Success)
     {
         throw new SkipException();
     }
     _operation.UpdateProgressWithCancellationCheck("Checking CM");
     FightData.SetCM(CombatData, AgentData, FightData);
     //
     _operation.UpdateProgressWithCancellationCheck("Creating Buff Container");
     Buffs = new BuffsContainer(LogData.GW2Version);
     _operation.UpdateProgressWithCancellationCheck("Creating Damage Modifier Container");
     DamageModifiers = new DamageModifiersContainer(LogData.GW2Version);
     _operation.UpdateProgressWithCancellationCheck("Creating Mechanic Data");
     MechanicData = FightData.Logic.GetMechanicData();
     _operation.UpdateProgressWithCancellationCheck("Creating General Statistics Container");
     Statistics = new GeneralStatistics(CombatData, PlayerList, Buffs);
 }
Beispiel #15
0
        public static GeneralStatistics GetGeneralStatistics(StatisticsQueryFlags queryFlags)
        {
            GeneralStatistics result = default(GeneralStatistics);

            result.QueryFlags = queryFlags;
            if ((byte)(queryFlags & StatisticsQueryFlags.Connections) != 0)
            {
                int num = 0;
                foreach (KeyValuePair <string, List <HTTPConnection> > current in HTTPManager.Connections)
                {
                    if (current.Value != null)
                    {
                        num += current.Value.Count;
                    }
                }
                result.Connections         = num;
                result.ActiveConnections   = HTTPManager.ActiveConnections.Count;
                result.FreeConnections     = HTTPManager.FreeConnections.Count;
                result.RecycledConnections = HTTPManager.RecycledConnections.Count;
                result.RequestsInQueue     = HTTPManager.RequestQueue.Count;
            }
            if ((byte)(queryFlags & StatisticsQueryFlags.Cache) != 0)
            {
                result.CacheEntityCount = HTTPCacheService.GetCacheEntityCount();
                result.CacheSize        = HTTPCacheService.GetCacheSize();
            }
            if ((byte)(queryFlags & StatisticsQueryFlags.Cookies) != 0)
            {
                List <Cookie> all = CookieJar.GetAll();
                result.CookieCount = all.Count;
                uint num2 = 0u;
                for (int i = 0; i < all.Count; i++)
                {
                    num2 += all[i].GuessSize();
                }
                result.CookieJarSize = num2;
            }
            return(result);
        }
Beispiel #16
0
 private void Awake()
 {
     _enemy = GetComponentInParent <EnemySensor>();
     _stats = GetComponentInParent <GeneralStatistics>();
 }
Beispiel #17
0
        public void testSwaptionPricing()
        {
            // Testing forward swap and swaption pricing
            const int size  = 10;
            const int steps = 8 * size;

#if QL_USE_INDEXED_COUPON
            const double tolerance = 1e-6;
#else
            const double tolerance = 1e-12;
#endif

            List <Date>   dates = new List <Date>();
            List <double> rates = new List <double>();
            dates.Add(new Date(4, 9, 2005));
            dates.Add(new Date(4, 9, 2011));
            rates.Add(0.04);
            rates.Add(0.08);

            IborIndex index = makeIndex(dates, rates);

            LiborForwardModelProcess process = new LiborForwardModelProcess(size, index);

            LmCorrelationModel corrModel = new LmExponentialCorrelationModel(size, 0.5);

            LmVolatilityModel volaModel = new LmLinearExponentialVolatilityModel(process.fixingTimes(),
                                                                                 0.291, 1.483, 0.116, 0.00001);

            // set-up pricing engine
            process.setCovarParam((LfmCovarianceParameterization)
                                  new LfmCovarianceProxy(volaModel, corrModel));

            // set-up a small Monte-Carlo simulation to price swations
            List <double> tmp = process.fixingTimes();

            TimeGrid grid = new TimeGrid(tmp, tmp.Count, steps);

            List <int> location = new List <int>();
            for (int i = 0; i < tmp.Count; ++i)
            {
                location.Add(grid.index(tmp[i]));
            }

            ulong     seed     = 42;
            const int nrTrails = 5000;
            LowDiscrepancy.icInstance = new InverseCumulativeNormal();

            IRNG rsg = (InverseCumulativeRsg <RandomSequenceGenerator <MersenneTwisterUniformRng>
                                              , InverseCumulativeNormal>)
                       new PseudoRandom().make_sequence_generator(process.factors() * (grid.size() - 1), seed);



            MultiPathGenerator <IRNG> generator = new MultiPathGenerator <IRNG>(process,
                                                                                grid,
                                                                                rsg, false);

            LiborForwardModel liborModel = new LiborForwardModel(process, volaModel, corrModel);

            Calendar              calendar   = index.fixingCalendar();
            DayCounter            dayCounter = index.forwardingTermStructure().link.dayCounter();
            BusinessDayConvention convention = index.businessDayConvention();

            Date settlement = index.forwardingTermStructure().link.referenceDate();

            SwaptionVolatilityMatrix m = liborModel.getSwaptionVolatilityMatrix();

            for (int i = 1; i < size; ++i)
            {
                for (int j = 1; j <= size - i; ++j)
                {
                    Date fwdStart    = settlement + new Period(6 * i, TimeUnit.Months);
                    Date fwdMaturity = fwdStart + new Period(6 * j, TimeUnit.Months);

                    Schedule schedule = new Schedule(fwdStart, fwdMaturity, index.tenor(), calendar,
                                                     convention, convention, DateGeneration.Rule.Forward, false);

                    double      swapRate    = 0.0404;
                    VanillaSwap forwardSwap = new VanillaSwap(VanillaSwap.Type.Receiver, 1.0,
                                                              schedule, swapRate, dayCounter,
                                                              schedule, index, 0.0, index.dayCounter());
                    forwardSwap.setPricingEngine(new DiscountingSwapEngine(index.forwardingTermStructure()));

                    // check forward pricing first
                    double expected   = forwardSwap.fairRate();
                    double calculated = liborModel.S_0(i - 1, i + j - 1);

                    if (Math.Abs(expected - calculated) > tolerance)
                    {
                        QAssert.Fail("Failed to reproduce fair forward swap rate"
                                     + "\n    calculated: " + calculated
                                     + "\n    expected:   " + expected);
                    }

                    swapRate    = forwardSwap.fairRate();
                    forwardSwap =
                        new VanillaSwap(VanillaSwap.Type.Receiver, 1.0,
                                        schedule, swapRate, dayCounter,
                                        schedule, index, 0.0, index.dayCounter());
                    forwardSwap.setPricingEngine(new DiscountingSwapEngine(index.forwardingTermStructure()));

                    if (i == j && i <= size / 2)
                    {
                        IPricingEngine engine =
                            new LfmSwaptionEngine(liborModel, index.forwardingTermStructure());
                        Exercise exercise =
                            new EuropeanExercise(process.fixingDates()[i]);

                        Swaption swaption =
                            new Swaption(forwardSwap, exercise);
                        swaption.setPricingEngine(engine);

                        GeneralStatistics stat = new GeneralStatistics();

                        for (int n = 0; n < nrTrails; ++n)
                        {
                            Sample <IPath> path = (n % 2 != 0) ? generator.antithetic()
                                          : generator.next();
                            MultiPath value = path.value as MultiPath;
                            Utils.QL_REQUIRE(value != null, () => "Invalid Path");
                            //Sample<MultiPath> path = generator.next();
                            List <double> rates_ = new InitializedList <double>(size);
                            for (int k = 0; k < process.size(); ++k)
                            {
                                rates_[k] = value[k][location[i]];
                            }
                            List <double> dis = process.discountBond(rates_);

                            double npv = 0.0;
                            for (int k = i; k < i + j; ++k)
                            {
                                npv += (swapRate - rates_[k])
                                       * (process.accrualEndTimes()[k]
                                          - process.accrualStartTimes()[k]) * dis[k];
                            }
                            stat.add(Math.Max(npv, 0.0));
                        }

                        if (Math.Abs(swaption.NPV() - stat.mean())
                            > stat.errorEstimate() * 2.35)
                        {
                            QAssert.Fail("Failed to reproduce swaption npv"
                                         + "\n    calculated: " + stat.mean()
                                         + "\n    expected:   " + swaption.NPV());
                        }
                    }
                }
            }
        }
Beispiel #18
0
 public void LoseFocus()
 {
     LockMarker.SetActive(false);
     CurrentFocusedCharacter = null;
     TargetPanel.SetActive(false);
 }
        public void testCallableEquityPricing()
        {
            // Testing the pricing of a callable equity product

            /*
             * For the definition of the example product see
             * Alexander Giese, On the Pricing of Auto-Callable Equity
             * Structures in the Presence of Stochastic Volatility and
             * Stochastic Interest Rates .
             * http://workshop.mathfinance.de/2006/papers/giese/slides.pdf
             */

            int        maturity = 7;
            DayCounter dc       = new Actual365Fixed();
            Date       today    = Date.Today;

            Settings.Instance.setEvaluationDate(today);

            Handle <Quote> spot             = new Handle <Quote>(new SimpleQuote(100.0));
            SimpleQuote    qRate            = new SimpleQuote(0.04);
            Handle <YieldTermStructure> qTS = new Handle <YieldTermStructure>(Utilities.flatRate(today, qRate, dc));
            SimpleQuote rRate = new SimpleQuote(0.04);
            Handle <YieldTermStructure> rTS = new Handle <YieldTermStructure>(Utilities.flatRate(today, rRate, dc));

            HestonProcess hestonProcess = new HestonProcess(rTS, qTS, spot, 0.0625, 1.0, 0.24 * 0.24, 1e-4, 0.0);
            // FLOATING_POINT_EXCEPTION
            HullWhiteForwardProcess hwProcess = new HullWhiteForwardProcess(rTS, 0.00883, 0.00526);

            hwProcess.setForwardMeasureTime(dc.yearFraction(today, today + new Period(maturity + 1, TimeUnit.Years)));

            HybridHestonHullWhiteProcess jointProcess = new HybridHestonHullWhiteProcess(hestonProcess, hwProcess, -0.4);

            Schedule schedule = new Schedule(today, today + new Period(maturity, TimeUnit.Years), new Period(1, TimeUnit.Years),
                                             new TARGET(), BusinessDayConvention.Following, BusinessDayConvention.Following, DateGeneration.Rule.Forward, false);

            List <double> times = new InitializedList <double>(maturity + 1);

            for (int i = 0; i <= maturity; ++i)
            {
                times[i] = i;
            }

            TimeGrid grid = new TimeGrid(times, times.Count);

            List <double> redemption = new InitializedList <double>(maturity);

            for (int i = 0; i < maturity; ++i)
            {
                redemption[i] = 1.07 + 0.03 * i;
            }

            ulong seed = 42;
            IRNG  rsg  = (InverseCumulativeRsg <RandomSequenceGenerator <MersenneTwisterUniformRng>
                                                , InverseCumulativeNormal>)
                         new PseudoRandom().make_sequence_generator(jointProcess.factors() * (grid.size() - 1), seed);

            MultiPathGenerator <IRNG> generator = new MultiPathGenerator <IRNG>(jointProcess, grid, rsg, false);
            GeneralStatistics         stat      = new GeneralStatistics();

            double antitheticPayoff = 0;
            int    nrTrails         = 40000;

            for (int i = 0; i < nrTrails; ++i)
            {
                bool antithetic = (i % 2) != 0;

                Sample <IPath> path  = antithetic ? generator.antithetic() : generator.next();
                MultiPath      value = path.value as MultiPath;
                Utils.QL_REQUIRE(value != null, () => "Invalid Path");

                double payoff = 0;
                for (int j = 1; j <= maturity; ++j)
                {
                    if (value[0][j] > spot.link.value())
                    {
                        Vector states = new Vector(3);
                        for (int k = 0; k < 3; ++k)
                        {
                            states[k] = value[k][j];
                        }
                        payoff = redemption[j - 1] / jointProcess.numeraire(grid[j], states);
                        break;
                    }
                    else if (j == maturity)
                    {
                        Vector states = new Vector(3);
                        for (int k = 0; k < 3; ++k)
                        {
                            states[k] = value[k][j];
                        }
                        payoff = 1.0 / jointProcess.numeraire(grid[j], states);
                    }
                }

                if (antithetic)
                {
                    stat.add(0.5 * (antitheticPayoff + payoff));
                }
                else
                {
                    antitheticPayoff = payoff;
                }
            }

            double expected   = 0.938;
            double calculated = stat.mean();
            double error      = stat.errorEstimate();

            if (Math.Abs(expected - calculated) > 3 * error)
            {
                QAssert.Fail("Failed to reproduce auto-callable equity structure price"
                             + "\n   calculated: " + calculated
                             + "\n   error:      " + error
                             + "\n   expected:   " + expected);
            }
        }
        public static LogDataDto BuildLogData(ParsedLog log, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBuffs, HashSet <DamageModifier> usedDamageMods, bool cr, bool light)
        {
            GeneralStatistics statistics = log.Statistics;

            log.UpdateProgressWithCancellationCheck("HTML: building Log Data");
            var logData = new LogDataDto();

            if (cr)
            {
                logData.CrData = new CombatReplayDto(log);
            }
            log.UpdateProgressWithCancellationCheck("HTML: building Players");
            foreach (Player player in log.PlayerList)
            {
                logData.HasCommander = logData.HasCommander || player.HasCommanderTag;
                logData.Players.Add(new PlayerDto(player, log, cr, ActorDetailsDto.BuildPlayerData(log, player, usedSkills, usedBuffs)));
            }

            log.UpdateProgressWithCancellationCheck("HTML: building Enemies");
            foreach (AbstractActor enemy in log.MechanicData.GetEnemyList(log, 0))
            {
                logData.Enemies.Add(new EnemyDto()
                {
                    Name = enemy.Character
                });
            }

            log.UpdateProgressWithCancellationCheck("HTML: building Targets");
            foreach (NPC target in log.FightData.Logic.Targets)
            {
                var targetDto = new TargetDto(target, log, cr, ActorDetailsDto.BuildTargetData(log, target, usedSkills, usedBuffs, cr));
                logData.Targets.Add(targetDto);
            }
            //
            log.UpdateProgressWithCancellationCheck("HTML: building Skill/Buff dictionaries");
            Dictionary <string, List <Buff> >           persBuffDict      = BuildPersonalBoonData(log, logData.PersBuffs, usedBuffs);
            Dictionary <string, List <DamageModifier> > persDamageModDict = BuildPersonalDamageModData(log, logData.DmgModifiersPers, usedDamageMods);
            var allDamageMods = new HashSet <string>();

            foreach (Player p in log.PlayerList)
            {
                allDamageMods.UnionWith(p.GetPresentDamageModifier(log));
            }
            var commonDamageModifiers = new List <DamageModifier>();

            if (log.DamageModifiers.DamageModifiersPerSource.TryGetValue(GeneralHelper.Source.Common, out List <DamageModifier> list))
            {
                foreach (DamageModifier dMod in list)
                {
                    if (allDamageMods.Contains(dMod.Name))
                    {
                        commonDamageModifiers.Add(dMod);
                        logData.DmgModifiersCommon.Add(dMod.Name.GetHashCode());
                        usedDamageMods.Add(dMod);
                    }
                }
            }
            if (log.DamageModifiers.DamageModifiersPerSource.TryGetValue(GeneralHelper.Source.FightSpecific, out list))
            {
                foreach (DamageModifier dMod in list)
                {
                    if (allDamageMods.Contains(dMod.Name))
                    {
                        commonDamageModifiers.Add(dMod);
                        logData.DmgModifiersCommon.Add(dMod.Name.GetHashCode());
                        usedDamageMods.Add(dMod);
                    }
                }
            }
            var itemDamageModifiers = new List <DamageModifier>();

            if (log.DamageModifiers.DamageModifiersPerSource.TryGetValue(GeneralHelper.Source.Item, out list))
            {
                foreach (DamageModifier dMod in list)
                {
                    if (allDamageMods.Contains(dMod.Name))
                    {
                        itemDamageModifiers.Add(dMod);
                        logData.DmgModifiersItem.Add(dMod.Name.GetHashCode());
                        usedDamageMods.Add(dMod);
                    }
                }
            }
            foreach (Buff boon in statistics.PresentBoons)
            {
                logData.Boons.Add(boon.ID);
                usedBuffs[boon.ID] = boon;
            }
            foreach (Buff boon in statistics.PresentConditions)
            {
                logData.Conditions.Add(boon.ID);
                usedBuffs[boon.ID] = boon;
            }
            foreach (Buff boon in statistics.PresentOffbuffs)
            {
                logData.OffBuffs.Add(boon.ID);
                usedBuffs[boon.ID] = boon;
            }
            foreach (Buff boon in statistics.PresentDefbuffs)
            {
                logData.DefBuffs.Add(boon.ID);
                usedBuffs[boon.ID] = boon;
            }
            foreach (Buff boon in statistics.PresentFractalInstabilities)
            {
                logData.FractalInstabilities.Add(boon.ID);
                usedBuffs[boon.ID] = boon;
            }
            //
            log.UpdateProgressWithCancellationCheck("HTML: building Phases");
            List <PhaseData> phases = log.FightData.GetPhases(log);

            for (int i = 0; i < phases.Count; i++)
            {
                PhaseData phaseData = phases[i];
                var       phaseDto  = new PhaseDto(phaseData, phases, log)
                {
                    DpsStats        = PhaseDto.BuildDPSData(log, i),
                    DpsStatsTargets = PhaseDto.BuildDPSTargetsData(log, i),
                    DmgStatsTargets = PhaseDto.BuildDMGStatsTargetsData(log, i),
                    DmgStats        = PhaseDto.BuildDMGStatsData(log, i),
                    DefStats        = PhaseDto.BuildDefenseData(log, i),
                    SupportStats    = PhaseDto.BuildSupportData(log, i),
                    //
                    BoonStats             = BuffData.BuildBuffUptimeData(log, statistics.PresentBoons, i),
                    OffBuffStats          = BuffData.BuildBuffUptimeData(log, statistics.PresentOffbuffs, i),
                    DefBuffStats          = BuffData.BuildBuffUptimeData(log, statistics.PresentDefbuffs, i),
                    PersBuffStats         = BuffData.BuildPersonalBuffUptimeData(log, persBuffDict, i),
                    BoonGenSelfStats      = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.Self),
                    BoonGenGroupStats     = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.Group),
                    BoonGenOGroupStats    = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.OffGroup),
                    BoonGenSquadStats     = BuffData.BuildBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.Squad),
                    OffBuffGenSelfStats   = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.Self),
                    OffBuffGenGroupStats  = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.Group),
                    OffBuffGenOGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.OffGroup),
                    OffBuffGenSquadStats  = BuffData.BuildBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.Squad),
                    DefBuffGenSelfStats   = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, i, BuffEnum.Self),
                    DefBuffGenGroupStats  = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, i, BuffEnum.Group),
                    DefBuffGenOGroupStats = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, i, BuffEnum.OffGroup),
                    DefBuffGenSquadStats  = BuffData.BuildBuffGenerationData(log, statistics.PresentDefbuffs, i, BuffEnum.Squad),
                    //
                    BoonActiveStats             = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentBoons, i),
                    OffBuffActiveStats          = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentOffbuffs, i),
                    DefBuffActiveStats          = BuffData.BuildActiveBuffUptimeData(log, statistics.PresentDefbuffs, i),
                    PersBuffActiveStats         = BuffData.BuildActivePersonalBuffUptimeData(log, persBuffDict, i),
                    BoonGenActiveSelfStats      = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.Self),
                    BoonGenActiveGroupStats     = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.Group),
                    BoonGenActiveOGroupStats    = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.OffGroup),
                    BoonGenActiveSquadStats     = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentBoons, i, BuffEnum.Squad),
                    OffBuffGenActiveSelfStats   = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.Self),
                    OffBuffGenActiveGroupStats  = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.Group),
                    OffBuffGenActiveOGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.OffGroup),
                    OffBuffGenActiveSquadStats  = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentOffbuffs, i, BuffEnum.Squad),
                    DefBuffGenActiveSelfStats   = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, i, BuffEnum.Self),
                    DefBuffGenActiveGroupStats  = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, i, BuffEnum.Group),
                    DefBuffGenActiveOGroupStats = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, i, BuffEnum.OffGroup),
                    DefBuffGenActiveSquadStats  = BuffData.BuildActiveBuffGenerationData(log, statistics.PresentDefbuffs, i, BuffEnum.Squad),
                    //
                    DmgModifiersCommon = DamageModData.BuildDmgModifiersData(log, i, commonDamageModifiers),
                    DmgModifiersItem   = DamageModData.BuildDmgModifiersData(log, i, itemDamageModifiers),
                    DmgModifiersPers   = DamageModData.BuildPersonalDmgModifiersData(log, i, persDamageModDict),
                    TargetsCondiStats  = new List <List <BuffData> >(),
                    TargetsCondiTotals = new List <BuffData>(),
                    TargetsBoonTotals  = new List <BuffData>(),
                    MechanicStats      = MechanicDto.BuildPlayerMechanicData(log, i),
                    EnemyMechanicStats = MechanicDto.BuildEnemyMechanicData(log, i)
                };
                foreach (NPC target in phaseData.Targets)
                {
                    phaseDto.TargetsCondiStats.Add(BuffData.BuildTargetCondiData(log, i, target));
                    phaseDto.TargetsCondiTotals.Add(BuffData.BuildTargetCondiUptimeData(log, i, target));
                    phaseDto.TargetsBoonTotals.Add(HasBoons(log, i, target) ? BuffData.BuildTargetBoonData(log, i, target) : null);
                }
                logData.Phases.Add(phaseDto);
            }
            //
            log.UpdateProgressWithCancellationCheck("HTML: building Meta Data");
            logData.EncounterDuration = log.FightData.DurationString;
            logData.Success           = log.FightData.Success;
            logData.Wvw         = log.FightData.Logic.Mode == FightLogic.ParseMode.WvW;
            logData.Targetless  = log.FightData.Logic.Targetless;
            logData.FightName   = log.FightData.GetFightName(log);
            logData.FightIcon   = log.FightData.Logic.Icon;
            logData.LightTheme  = light;
            logData.SingleGroup = log.PlayerList.Where(x => !x.IsFakeActor).Select(x => x.Group).Distinct().Count() == 1;
            logData.NoMechanics = log.FightData.Logic.HasNoFightSpecificMechanics;
            if (log.LogData.LogErrors.Count > 0)
            {
                logData.LogErrors = new List <string>(log.LogData.LogErrors);
            }
            //
            SkillDto.AssembleSkills(usedSkills.Values, logData.SkillMap);
            DamageModDto.AssembleDamageModifiers(usedDamageMods, logData.DamageModMap);
            BuffDto.AssembleBoons(usedBuffs.Values, logData.BuffMap, log);
            MechanicDto.BuildMechanics(log.MechanicData.GetPresentMechanics(log, 0), logData.MechanicMap);
            return(logData);
        }
Beispiel #21
0
    // Token: 0x060025A8 RID: 9640 RVA: 0x000B99E4 File Offset: 0x000B7DE4
    private void OnGUI()
    {
        GeneralStatistics stats = HTTPManager.GetGeneralStatistics(StatisticsQueryFlags.All);

        GUIHelper.DrawArea(new Rect(0f, 0f, (float)(Screen.width / 3), 160f), false, delegate
        {
            GUIHelper.DrawCenteredText("Connections");
            GUILayout.Space(5f);
            GUIHelper.DrawRow("Sum:", stats.Connections.ToString());
            GUIHelper.DrawRow("Active:", stats.ActiveConnections.ToString());
            GUIHelper.DrawRow("Free:", stats.FreeConnections.ToString());
            GUIHelper.DrawRow("Recycled:", stats.RecycledConnections.ToString());
            GUIHelper.DrawRow("Requests in queue:", stats.RequestsInQueue.ToString());
        });
        GUIHelper.DrawArea(new Rect((float)(Screen.width / 3), 0f, (float)(Screen.width / 3), 160f), false, delegate
        {
            GUIHelper.DrawCenteredText("Cache");
            if (!HTTPCacheService.IsSupported)
            {
                GUI.color = Color.yellow;
                GUIHelper.DrawCenteredText("Disabled in WebPlayer, WebGL & Samsung Smart TV Builds!");
                GUI.color = Color.white;
            }
            else
            {
                GUILayout.Space(5f);
                GUIHelper.DrawRow("Cached entities:", stats.CacheEntityCount.ToString());
                GUIHelper.DrawRow("Sum Size (bytes): ", stats.CacheSize.ToString("N0"));
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Clear Cache", new GUILayoutOption[0]))
                {
                    HTTPCacheService.BeginClear();
                }
                GUILayout.EndVertical();
            }
        });
        GUIHelper.DrawArea(new Rect((float)(Screen.width / 3 * 2), 0f, (float)(Screen.width / 3), 160f), false, delegate
        {
            GUIHelper.DrawCenteredText("Cookies");
            if (!CookieJar.IsSavingSupported)
            {
                GUI.color = Color.yellow;
                GUIHelper.DrawCenteredText("Saving and loading from disk is disabled in WebPlayer, WebGL & Samsung Smart TV Builds!");
                GUI.color = Color.white;
            }
            else
            {
                GUILayout.Space(5f);
                GUIHelper.DrawRow("Cookies:", stats.CookieCount.ToString());
                GUIHelper.DrawRow("Estimated size (bytes):", stats.CookieJarSize.ToString("N0"));
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Clear Cookies", new GUILayoutOption[0]))
                {
                    HTTPManager.OnQuit();
                }
                GUILayout.EndVertical();
            }
        });
        if (SampleSelector.SelectedSample == null || (SampleSelector.SelectedSample != null && !SampleSelector.SelectedSample.IsRunning))
        {
            GUIHelper.DrawArea(new Rect(0f, 165f, (float)((SampleSelector.SelectedSample != null) ? (Screen.width / 3) : Screen.width), (float)(Screen.height - 160 - 5)), false, delegate
            {
                this.scrollPos = GUILayout.BeginScrollView(this.scrollPos, new GUILayoutOption[0]);
                for (int i = 0; i < this.Samples.Count; i++)
                {
                    this.DrawSample(this.Samples[i]);
                }
                GUILayout.EndScrollView();
            });
            if (SampleSelector.SelectedSample != null)
            {
                this.DrawSampleDetails(SampleSelector.SelectedSample);
            }
        }
        else if (SampleSelector.SelectedSample != null && SampleSelector.SelectedSample.IsRunning)
        {
            GUILayout.BeginArea(new Rect(0f, (float)(Screen.height - 50), (float)Screen.width, 50f), string.Empty);
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Back", new GUILayoutOption[]
            {
                GUILayout.MinWidth(100f)
            }))
            {
                SampleSelector.SelectedSample.DestroyUnityObject();
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }
    }