Пример #1
0
        public StatisticsWin(IBaseWindow baseWin, List <GEDCOMRecord> selectedRecords)
        {
            InitializeComponent();

            fGraph = new ZGraphControl();

            fListStats = new GKListView();
            fListStats.AddColumn("-", 250, false);
            fListStats.AddColumn("-", 150, false);

            Splitter spl = new Splitter();

            spl.Panel1                 = fListStats;
            spl.Panel2                 = fGraph;
            spl.RelativePosition       = 300;
            spl.Orientation            = Orientation.Horizontal;
            spl.FixedPanel             = SplitterFixedPanel.Panel2;
            panDataPlaceholder.Content = spl;

            fBase            = baseWin;
            fSelectedRecords = selectedRecords;
            fTreeStats       = new TreeStats(fBase.Context, fSelectedRecords);
            fCurrentMode     = StatsMode.smAncestors;

            SetLang();
        }
Пример #2
0
        private void UpdateCloud()
        {
            try {
                fWords.Clear();

                if (fBase != null)
                {
                    List <StatsItem> vals      = new List <StatsItem>();
                    TreeStats        treeStats = new TreeStats(fBase.Context, fBase.GetContentList(GEDCOMRecordType.rtIndividual));
                    treeStats.GetSpecStats(fMode, vals);

                    fWords.Capacity = vals.Count;
                    foreach (var statsItem in vals)
                    {
                        string word = statsItem.Caption;
                        if (word != "?")
                        {
                            fWords.Add(new Word(statsItem.Caption, statsItem.Value));
                        }
                    }
                    fWords.Sort(CompareWords);
                }

                cloudViewer.WeightedWords = fWords;
            } catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
    //gets the stats of a CNM behaviour tree
    public void InspectCNM(CNMEnemy t_character)
    {
        TreeStats charStats = t_character.stats;


        NodesEvalText.text       = "" + charStats.getNodes();
        ConditionsCheckText.text = "" + charStats.getConditions();
        ActionsPerformText.text  = "" + charStats.getActions();
    }
Пример #4
0
        private void DisplayTreeStats(IProtoBufSerializer serializer, GetFileSystemResponse response, bool verbose)
        {
            Trace.WriteLine("=====================================================================");
            Trace.WriteLine("FileSystem tree stats:");
            {
                var mem         = new MemoryStream();
                var sw          = new Stopwatch();
                var ipcResponse = new IpcResponse {
                    RequestId = 0,
                    Protocol  = IpcProtocols.TypedMessage,
                    Data      = response
                };
                sw.Start();
                serializer.Serialize(mem, ipcResponse);
                sw.Stop();
                Trace.WriteLine(string.Format("ProtoBuf request of {0:n0} bytes serialized in {1} msec.", mem.Length,
                                              sw.ElapsedMilliseconds));
            }

            var stats = new TreeStats();

            stats.ProcessTree(null, "", response.Tree.Root);
            Trace.WriteLine(string.Format("Directory count: {0:n0}", stats.DirectoryCount));
            Trace.WriteLine(string.Format("File count: {0:n0}", stats.FileCount));
            Trace.WriteLine(string.Format("Total File size: {0:n0} bytes", stats.TotalSize));
            if (verbose)
            {
                Trace.WriteLine("=====================================================================");
                Trace.WriteLine(" Files sorted by count");
                foreach (var item in stats.Extensions.OrderByDescending(x => x.Value.FileCount))
                {
                    Trace.WriteLine(string.Format("Extension \"{0}\": {1:n0} files, {2:n0} bytes", item.Key.ToUpperInvariant(),
                                                  item.Value.FileCount, item.Value.TotalSize));
                }

                Trace.WriteLine("=====================================================================");
                Trace.WriteLine(" Files sorted by total length");
                foreach (var item in stats.Extensions.OrderByDescending(x => x.Value.TotalSize))
                {
                    Trace.WriteLine(string.Format("Extension \"{0}\": {2:n0} bytes, {1:n0} files", item.Key.ToUpperInvariant(),
                                                  item.Value.FileCount, item.Value.TotalSize));
                }

                OutputDirectorytree(0, "", stats.RootDirectory);
            }
        }
Пример #5
0
        protected override void InternalGenerate()
        {
            IColor clrBlack = AppHost.GfxProvider.CreateColor(0x000000);
            IColor clrBlue  = AppHost.GfxProvider.CreateColor(0x0000FF);

            fTitleFont = fWriter.CreateFont("", 22f, true, false, clrBlack);
            fChapFont  = fWriter.CreateFont("", 16f, true, false, clrBlack);
            fTextFont  = fWriter.CreateFont("", 10f, false, false, clrBlack);

            var stats = new TreeStats(fBase.Context, fBase.GetContentList(GDMRecordType.rtIndividual));

            fStats = stats.GetCommonStats();

            fWriter.AddParagraph(fTitle, fTitleFont, TextAlignment.taLeft);

            var personRange = GetIndividualDates(fPerson);

            fWriter.AddParagraph(GetPersonalInfo(fPerson), fChapFont, TextAlignment.taLeft);

            fWriter.BeginList();

            var       enumer = fBase.Context.Tree.GetEnumerator(GDMRecordType.rtIndividual);
            GDMRecord record;

            while (enumer.MoveNext(out record))
            {
                var iRec     = record as GDMIndividualRecord;
                var indRange = GetIndividualDates(iRec);
                try {
                    if (personRange.IsOverlapped(indRange))
                    {
                        fWriter.AddListItem(" " + GetPersonalInfo(iRec), fTextFont);
                    }
                } catch (Exception ex) {
                    Logger.LogWrite("ContemporariesReport.InternalGenerate(): " + ex.Message);
                }
            }

            fWriter.EndList();
        }
Пример #6
0
        public StatisticsWin(IBaseWindow baseWin, List <GEDCOMRecord> selectedRecords)
        {
            InitializeComponent();

            tbExcelExport.Image = GKResources.iExcel;

            fGraph      = new ZGraphControl();
            fGraph.Dock = DockStyle.Right;
            fGraph.Size = new Size(400, 200);

            Splitter spl = new Splitter();

            spl.Dock     = DockStyle.Right;
            spl.Size     = new Size(4, 290);
            spl.MinExtra = 100;
            spl.MinSize  = 100;
            Panel1.Controls.Add(fGraph);
            Panel1.Controls.Add(spl);

            fListStats = UIHelper.CreateListView(Panel1);
            fListStats.AddColumn("-", 250, false);
            fListStats.AddColumn("-", 150, false);

            Panel1.Controls.SetChildIndex(fListStats, 0);
            Panel1.Controls.SetChildIndex(spl, 2);
            Panel1.Controls.SetChildIndex(fGraph, 3);
            Panel1.Controls.SetChildIndex(ToolBar1, 4);

            fBase            = baseWin;
            fSelectedRecords = selectedRecords;
            fTreeStats       = new TreeStats(fBase.Context, fSelectedRecords);

            UpdateStatsTypes();

            SetLang();
        }
Пример #7
0
    void OnCollisionEnter2D(Collision2D other)
    {
        DirtStats   otherDirtValues   = other.gameObject.GetComponent <DirtStats>();
        CloudStats  otherCloudValues  = other.gameObject.GetComponent <CloudStats>();
        StoneStats  otherStoneValues  = other.gameObject.GetComponent <StoneStats>();
        TreeStats   otherTreeValues   = other.gameObject.GetComponent <TreeStats>();
        PlayerStats otherPlayerValues = other.gameObject.GetComponent <PlayerStats>();
        BarrelStats otherBarrelValues = other.gameObject.GetComponent <BarrelStats>();

        if (gameObject.tag == "PickedUpObject")
        {
            particleManager.SpawnBigSpark(this.transform.position);

            if (other.gameObject.tag == "Dirt")
            {
                otherDirtValues.dirtHP -= stoneATK;

                gameObject.tag         = "Stone";
                RaycastScript.isThrown = false;
            }

            if (other.gameObject.tag == "Stone")
            {
                otherStoneValues.stoneHP -= stoneATK;

                gameObject.tag         = "Stone";
                RaycastScript.isThrown = false;
            }

            if (other.gameObject.tag == "Cloud")
            {
                otherCloudValues.cloudHP -= stoneATK;

                gameObject.tag         = "Stone";
                RaycastScript.isThrown = false;
            }

            if (other.gameObject.tag == "Tree")
            {
                otherTreeValues.treeHP -= stoneATK;

                gameObject.tag         = "Stone";
                RaycastScript.isThrown = false;
            }

            if (other.gameObject.tag == "Wood")
            {
                otherTreeValues.treeHP -= stoneATK;

                gameObject.tag         = "Stone";
                RaycastScript.isThrown = false;
            }

            if (other.gameObject.tag == "Barrel")
            {
                otherBarrelValues.barrelHP -= stoneATK;

                gameObject.tag         = "Stone";
                RaycastScript.isThrown = false;
            }

            if (other.gameObject.tag == "Player")
            {
                otherPlayerValues.TakeDamage(stoneATK);

                gameObject.tag         = "Stone";
                RaycastScript.isThrown = false;
            }

            if (other.gameObject.tag == "Player2")
            {
                otherPlayerValues.TakeDamage(stoneATK);

                gameObject.tag         = "Stone";
                RaycastScript.isThrown = false;
            }

            if (other.gameObject.tag == "Player3")
            {
                otherPlayerValues.TakeDamage(stoneATK);

                gameObject.tag         = "Stone";
                RaycastScript.isThrown = false;
            }

            if (other.gameObject.tag == "Player4")
            {
                otherPlayerValues.TakeDamage(stoneATK);

                gameObject.tag         = "Stone";
                RaycastScript.isThrown = false;
            }
        }
    }
Пример #8
0
        public void Test_Stats()
        {
            CompositeItem compositeItem = new CompositeItem();

            Assert.IsNotNull(compositeItem);
            compositeItem.TakeVal(0.0f, GDMSex.svMale, true);
            Assert.AreEqual(0, compositeItem.CommonVal);
            Assert.AreEqual(0, compositeItem.MaleVal);
            Assert.AreEqual(0, compositeItem.FemaleVal);
            compositeItem.TakeVal(1f, GDMSex.svFemale, true);
            compositeItem.TakeVal(1f, GDMSex.svMale, true);
            Assert.AreEqual(1, compositeItem.CommonVal);
            Assert.AreEqual(1, compositeItem.MaleVal);
            Assert.AreEqual(1, compositeItem.FemaleVal);
            compositeItem.TakeVal("1", GDMSex.svFemale, true);
            compositeItem.TakeVal("1", GDMSex.svMale, true);
            Assert.AreEqual(1, compositeItem.CommonVal);
            Assert.AreEqual(1, compositeItem.MaleVal);
            Assert.AreEqual(1, compositeItem.FemaleVal);

            StatsItem statsItem = new StatsItem("test", false);

            Assert.IsNotNull(statsItem);
            Assert.AreEqual("test", statsItem.ToString());

            statsItem = new StatsItem("test2", 0);
            Assert.IsNotNull(statsItem);
            Assert.AreEqual("test2", statsItem.ToString());

            List <GDMRecord>      selectedRecords = new List <GDMRecord>();
            IGEDCOMTreeEnumerator iEnum           = fContext.Tree.GetEnumerator(GDMRecordType.rtIndividual);
            GDMRecord             current;

            while (iEnum.MoveNext(out current))
            {
                selectedRecords.Add(current);
            }

            TreeStats treeStats = new TreeStats(fContext, selectedRecords);

            Assert.IsNotNull(treeStats);

            CommonStats commonStats = treeStats.GetCommonStats();

            Assert.IsNotNull(commonStats);
            Assert.AreEqual(6, commonStats.persons, "Stats.TotalPersons");
            Assert.AreEqual(2, commonStats.persons_m, "Stats.SumM");
            Assert.AreEqual(4, commonStats.persons_f, "Stats.SumF");

            List <StatsItem> values = new List <StatsItem>();

            treeStats.GetSpecStats(StatsMode.smAncestors, values);
            treeStats.GetSpecStats(StatsMode.smDescendants, values);
            treeStats.GetSpecStats(StatsMode.smDescGenerations, values);
            treeStats.GetSpecStats(StatsMode.smSurnames, values);
            treeStats.GetSpecStats(StatsMode.smNames, values);
            treeStats.GetSpecStats(StatsMode.smPatronymics, values);
            treeStats.GetSpecStats(StatsMode.smAge, values);
            treeStats.GetSpecStats(StatsMode.smLifeExpectancy, values);
            treeStats.GetSpecStats(StatsMode.smBirthYears, values);
            treeStats.GetSpecStats(StatsMode.smBirthTenYears, values);
            treeStats.GetSpecStats(StatsMode.smDeathYears, values);
            treeStats.GetSpecStats(StatsMode.smDeathTenYears, values);
            treeStats.GetSpecStats(StatsMode.smChildsCount, values);
            treeStats.GetSpecStats(StatsMode.smChildsDistribution, values);
            treeStats.GetSpecStats(StatsMode.smBirthPlaces, values);
            treeStats.GetSpecStats(StatsMode.smDeathPlaces, values);
            treeStats.GetSpecStats(StatsMode.smResidences, values);
            treeStats.GetSpecStats(StatsMode.smOccupation, values);
            treeStats.GetSpecStats(StatsMode.smReligious, values);
            treeStats.GetSpecStats(StatsMode.smNational, values);
            treeStats.GetSpecStats(StatsMode.smEducation, values);
            treeStats.GetSpecStats(StatsMode.smCaste, values);
            treeStats.GetSpecStats(StatsMode.smFirstbornAge, values);
            treeStats.GetSpecStats(StatsMode.smMarriages, values);
            treeStats.GetSpecStats(StatsMode.smMarriageAge, values);
            treeStats.GetSpecStats(StatsMode.smSpousesDiff, values);
            treeStats.GetSpecStats(StatsMode.smHobby, values);
            treeStats.GetSpecStats(StatsMode.smAward, values);
            treeStats.GetSpecStats(StatsMode.smMili, values);
            treeStats.GetSpecStats(StatsMode.smMiliInd, values);
            treeStats.GetSpecStats(StatsMode.smMiliDis, values);
            treeStats.GetSpecStats(StatsMode.smMiliRank, values);
            treeStats.GetSpecStats(StatsMode.smAAF_1, values);
            treeStats.GetSpecStats(StatsMode.smAAF_2, values);
            treeStats.GetSpecStats(StatsMode.smCertaintyIndex, values);
            treeStats.GetSpecStats(StatsMode.smBirthByMonth, values);
            treeStats.GetSpecStats(StatsMode.smDemography, values);
        }
 public override void Init(IBaseWindow baseWin)
 {
     base.Init(baseWin);
     fTreeStats = new TreeStats(fBase.Context, fSelectedRecords);
 }
Пример #10
0
    void OnTriggerEnter2D(Collider2D col)
    {
        Rigidbody2D colRigidbody      = col.gameObject.GetComponent <Rigidbody2D>();
        DirtStats   otherDirtValues   = col.gameObject.GetComponent <DirtStats>();
        CloudStats  otherCloudValues  = col.gameObject.GetComponent <CloudStats>();
        StoneStats  otherStoneValues  = col.gameObject.GetComponent <StoneStats>();
        TreeStats   otherTreeValues   = col.gameObject.GetComponent <TreeStats>();
        PlayerStats otherPlayerValues = col.gameObject.GetComponent <PlayerStats>();
        BarrelStats otherBarrelValues = col.gameObject.GetComponent <BarrelStats>();

        if (exploded == true)
        {
            if (colRigidbody != null)
            {
                Vector2 target = col.gameObject.transform.position;
                Vector2 bomb   = gameObject.transform.position;

                Vector2 direction = 200f * (target - bomb);

                colRigidbody.AddForce(direction);

                particleManager.SpawnExplosion(this.transform.position);
            }

            if (col.gameObject.tag == "Dirt")
            {
                otherDirtValues.dirtHP -= barrelATK;
            }

            if (col.gameObject.tag == "Stone")
            {
                otherStoneValues.stoneHP -= barrelATK;
            }

            if (col.gameObject.tag == "Cloud")
            {
                otherCloudValues.cloudHP -= barrelATK;
            }

            if (col.gameObject.tag == "Tree")
            {
                otherTreeValues.treeHP -= barrelATK;
            }

            if (col.gameObject.tag == "Barrel")
            {
                otherBarrelValues.barrelHP -= barrelATK;
            }

            if (col.gameObject.tag == "Player")
            {
                otherPlayerValues.TakeDamage(barrelATK);
            }

            if (col.gameObject.tag == "Player2")
            {
                otherPlayerValues.TakeDamage(barrelATK);
            }

            if (col.gameObject.tag == "Player3")
            {
                otherPlayerValues.TakeDamage(barrelATK);
            }

            if (col.gameObject.tag == "Player4")
            {
                otherPlayerValues.TakeDamage(barrelATK);
            }
        }
    }
Пример #11
0
        private void OutputDirectorytree(int indent, string parentPath, TreeStats.DirectoryItem entry)
        {
            if (entry.Name != null) {
            var text = "";
            for (var i = 0; i < indent; i++) {
              text += "| ";
            }
            text += entry.Name;
            Trace.WriteLine(text);
              }

              foreach (var x in entry.Children) {
            OutputDirectorytree(indent + 1, parentPath + entry.Name, x);
              }
        }
Пример #12
0
        private void DisplayTreeStats(IProtoBufSerializer serializer, GetFileSystemResponse response, bool verbose)
        {
            Trace.WriteLine("=====================================================================");
              Trace.WriteLine("FileSystem tree stats:");
              {
            var mem = new MemoryStream();
            var sw = new Stopwatch();
            var ipcResponse = new IpcResponse {
              RequestId = 0,
              Protocol = IpcProtocols.TypedMessage,
              Data = response
            };
            sw.Start();
            serializer.Serialize(mem, ipcResponse);
            sw.Stop();
            Trace.WriteLine(string.Format("ProtoBuf request of {0:n0} bytes serialized in {1} msec.", mem.Length,
                                      sw.ElapsedMilliseconds));
              }

              var stats = new TreeStats();
              stats.ProcessTree(null, "", response.Tree.Root);
              Trace.WriteLine(string.Format("Directory count: {0:n0}", stats.DirectoryCount));
              Trace.WriteLine(string.Format("File count: {0:n0}", stats.FileCount));
              Trace.WriteLine(string.Format("Total File size: {0:n0} bytes", stats.TotalSize));
              if (verbose) {
            Trace.WriteLine("=====================================================================");
            Trace.WriteLine(" Files sorted by count");
            foreach (var item in stats.Extensions.OrderByDescending(x => x.Value.FileCount)) {
              Trace.WriteLine(string.Format("Extension \"{0}\": {1:n0} files, {2:n0} bytes", item.Key.ToUpperInvariant(),
                                        item.Value.FileCount, item.Value.TotalSize));
            }

            Trace.WriteLine("=====================================================================");
            Trace.WriteLine(" Files sorted by total length");
            foreach (var item in stats.Extensions.OrderByDescending(x => x.Value.TotalSize)) {
              Trace.WriteLine(string.Format("Extension \"{0}\": {2:n0} bytes, {1:n0} files", item.Key.ToUpperInvariant(),
                                        item.Value.FileCount, item.Value.TotalSize));
            }

            OutputDirectorytree(0, "", stats.RootDirectory);
              }
        }