Exemple #1
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Action == TreeViewAction.ByMouse)
            {
                string[] words = e.Node.FullPath.Split("\\,()".ToCharArray());
                if (words.Length <= 1)
                {
                    return;
                }

                Global.ViewInfo.ActorID = 0;
                Global.ViewInfo.IsList  = false;
                Global.ViewInfo.IsLeaf  = false;

                string strRoot = words[0];
                string strType = words[1];
                switch (strType)
                {
                case "Players":
                {
                    if (words.Length > 2)
                    {
                        int nID = Int32.Parse(e.Node.ToolTipText);
                        Global.ViewInfo.ActorID = nID;
                        Stats.PlayerElement element = Global.Storage_Player[nID];

                        treeViewSelectImpl(element, e.Node.Text);
                    }
                    else
                    {
                        Global.ViewInfo.IsNPC      = false;
                        Global.ViewInfo.IsList     = true;
                        Global.listReportsAnlaysis = Global.Storage_Player.ExtractReportAnalysis();
                        Global.listReportsAnlaysisColumnName.Add("이름");
                        Global.listReportsAnlaysisColumnName.Add("DPS");
                        Global.listReportsAnlaysisColumnName.Add("누적피해 (공격측)");
                        MakeInfomationView();
                    }
                } break;

                case "NPCs":
                {
                    if (words.Length > 2)
                    {
                        int nID = Int32.Parse(e.Node.ToolTipText);
                        Global.ViewInfo.ActorID = nID;
                        Stats.NPCElement element = Global.Storage_NPC[nID];

                        treeViewSelectImpl(element, e.Node.Text);
                    }
                    else
                    {
                        Global.ViewInfo.IsNPC      = true;
                        Global.ViewInfo.IsList     = true;
                        Global.listReportsAnlaysis = Global.Storage_NPC.ExtractReportAnalysis();
                        Global.listReportsAnlaysisColumnName.Add("이름");
                        Global.listReportsAnlaysisColumnName.Add("DPS");
                        Global.listReportsAnlaysisColumnName.Add("누적피해 (공격측)");
                        MakeInfomationView();
                    }
                } break;
                }
            }
        }
        void ParseXML(string strText)
        {
            XmlParserContext context = new XmlParserContext(null, null, null, XmlSpace.None);
            XmlTextReader    reader  = new XmlTextReader(strText, XmlNodeType.Element, context);

            if (!reader.Read())
            {
                return;
            }

            switch (reader.LocalName)
            {
            case "Command":
                Types.Command command;
                command = GetDeserialize <Types.Command>(strText);
                switch (command.Type)
                {
                case "start":
                    OnStart();
                    break;

                case "stop":
                    OnStop();
                    break;
                }
                break;

            case "Player":
            {
                Types.Player        xml_player = GetDeserialize <Types.Player>(strText);
                Stats.PlayerElement e          = new Stats.PlayerElement();
                e.proto = xml_player;
                if (Global.Storage_Player.Add(e.proto.UIID, e) &&
                    !Global.IsPrepareMode)
                {
                    MakeTreeViewItems();
                }
            }
            break;

            case "NPC":
            {
                NPC xml_npc        = GetDeserialize <Types.NPC>(strText);
                Stats.NPCElement e = new Stats.NPCElement();
                e.proto = xml_npc;
                if (Global.Storage_NPC.Add(e.proto.ID, e) &&
                    !Global.IsPrepareMode)
                {
                    MakeTreeViewItems();
                }
            }

            break;

            case "Stats":
            {
                Types.Stats xml_stats = GetDeserialize <Types.Stats>(strText);
                string      strType   = xml_stats.Type;

                Stats.ActorElement actorOwner = Global.FindActorElement(xml_stats.Owner);
                if (xml_stats.SourceType == "talent")
                {
                    int TalentID = xml_stats.SourceID;

                    switch (strType)
                    {
                    case "UseTalent":
                    {
                        Stats.TalentElement talentOwner = actorOwner.talentOffense.Get(TalentID);
                        ++talentOwner.Use;
                    }
                    break;

                    case "ActTalent":
                    {
                        Stats.TalentElement talentOwner = actorOwner.talentOffense.Get(TalentID);
                        ++talentOwner.Act;
                    }
                    break;

                    case "Damage":
                    {
                        Stats.ActorElement actorAttacker = Global.FindActorElement(xml_stats.Attacker);
                        if (actorAttacker != null)
                        {
                            Stats.TalentElement talentAttacker = actorAttacker.talentOffense.Get(TalentID);
                            talentAttacker.Damage += xml_stats.Damage;
                            Stats.TalentElement talentDefense = actorOwner.talentDefense.Get(TalentID);
                            talentDefense.Damage += xml_stats.Damage;
                        }
                    }
                    break;

                    default:
                    {
                        ParseStats(strType, actorOwner, xml_stats.Attacker, TalentID, 1);
                    }
                    break;
                    }
                }
                else if (xml_stats.SourceType == "combat_time")
                {
                    switch (strType)
                    {
                    case "Start":
                    {
                        if (actorOwner != null)
                        {
                            actorOwner.IsNowCombat = true;
                        }
                    }
                    break;

                    case "End":
                    {
                        if (actorOwner != null)
                        {
                            actorOwner.IsNowCombat = false;
                        }
                    }
                    break;
                    }
                }

                if (Global.ViewInfo.IsList)
                {
                    if (Global.ViewInfo.IsNPC)
                    {
                        Global.listReportsAnlaysis = Global.Storage_NPC.ExtractReportAnalysis();
                    }
                    else
                    {
                        Global.listReportsAnlaysis = Global.Storage_Player.ExtractReportAnalysis();
                    }
                    MakeInfomationView();
                }
                else
                {
                    if (!Global.ViewInfo.IsLeaf)
                    {
                        if (Global.ViewInfo.ActorID == xml_stats.Owner)
                        {
                            if (actorOwner != null)
                            {
                                if (Global.ViewInfo.IsAttack)
                                {
                                    MakeTalentView(actorOwner.talentOffense);
                                }
                                else
                                {
                                    MakeTalentView(actorOwner.talentDefense);
                                }
                            }
                        }
                        else if (Global.ViewInfo.ActorID == xml_stats.Attacker)
                        {
                            Stats.ActorElement actorAttacker = Global.FindActorElement(xml_stats.Attacker);
                            if (actorAttacker != null)
                            {
                                if (Global.ViewInfo.IsAttack)
                                {
                                    MakeTalentView(actorAttacker.talentOffense);
                                }
                                else
                                {
                                    MakeTalentView(actorAttacker.talentDefense);
                                }
                            }
                        }
                    }
                }
            }

            break;
            }

            reader.Close();
        }