Guest User

Untitled

a guest
May 3rd, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.13 KB | None | 0 0
  1. using HSGameEngine.GameEngine.Common;
  2. using HSGameEngine.GameEngine.Logic;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Xml.Linq;
  6. using UnityEngine;
  7.  
  8. public class NPCInfoVO
  9. {
  10.     public int ID;
  11.  
  12.     public int PicCode;
  13.  
  14.     public string ResName;
  15.  
  16.     public string YouShou;
  17.  
  18.     public string ZuoShou;
  19.  
  20.     public string Wing;
  21.  
  22.     public string FlyPet;
  23.  
  24.     public float Scale;
  25.  
  26.     public int ShaderID;
  27.  
  28.     public string GuaJieDian;
  29.  
  30.     public string GuaJieTeXiao;
  31.  
  32.     public string Function;
  33.  
  34.     public string SName;
  35.  
  36.     public int MapCode;
  37.  
  38.     public string Talk;
  39.  
  40.     public string SaleID;
  41.  
  42.     public string LuaScriptFile;
  43.  
  44.     public int Display;
  45.  
  46.     public string PlaySound;
  47.  
  48.     public float Interval;
  49.  
  50.     public string TakeSound;
  51.  
  52.     public bool IsCollide;
  53.  
  54.     public Vector3 CollideCenter = Vector3.zero;
  55.  
  56.     public Vector3 CollideSize = Vector3.zero;
  57.  
  58.     public int ObstacleX;
  59.  
  60.     public int ObstacleY;
  61.  
  62.     public int IsSafe = -1;
  63.  
  64.     private static Dictionary<string, int> _PropertyIndexDict;
  65.  
  66.     public static Dictionary<string, int> PropertyIndexDict
  67.     {
  68.         get
  69.         {
  70.             if (NPCInfoVO._PropertyIndexDict == null)
  71.             {
  72.                 NPCInfoVO._PropertyIndexDict = new Dictionary<string, int>();
  73.                 NPCInfoVO._PropertyIndexDict.Add("ID", 0);
  74.                 NPCInfoVO._PropertyIndexDict.Add("PicCode", 2);
  75.                 NPCInfoVO._PropertyIndexDict.Add("ResName", 3);
  76.                 NPCInfoVO._PropertyIndexDict.Add("YouShou", 4);
  77.                 NPCInfoVO._PropertyIndexDict.Add("ZuoShou", 5);
  78.                 NPCInfoVO._PropertyIndexDict.Add("Wing", 6);
  79.                 NPCInfoVO._PropertyIndexDict.Add("FlyPet", 7);
  80.                 NPCInfoVO._PropertyIndexDict.Add("Scale", 8);
  81.                 NPCInfoVO._PropertyIndexDict.Add("ShaderID", 9);
  82.                 NPCInfoVO._PropertyIndexDict.Add("GuaJieDian", 10);
  83.                 NPCInfoVO._PropertyIndexDict.Add("GuaJieTeXiao", 11);
  84.                 NPCInfoVO._PropertyIndexDict.Add("Function", 12);
  85.                 NPCInfoVO._PropertyIndexDict.Add("SName", 13);
  86.                 NPCInfoVO._PropertyIndexDict.Add("MapCode", 14);
  87.                 NPCInfoVO._PropertyIndexDict.Add("Talk", 15);
  88.                 NPCInfoVO._PropertyIndexDict.Add("SaleID", 19);
  89.                 NPCInfoVO._PropertyIndexDict.Add("LuaScriptFile", 20);
  90.                 NPCInfoVO._PropertyIndexDict.Add("Display", 22);
  91.                 NPCInfoVO._PropertyIndexDict.Add("PlaySound", 23);
  92.                 NPCInfoVO._PropertyIndexDict.Add("Interval", 24);
  93.                 NPCInfoVO._PropertyIndexDict.Add("TakeSound", 25);
  94.                 NPCInfoVO._PropertyIndexDict.Add("Collide", 26);
  95.                 NPCInfoVO._PropertyIndexDict.Add("Obstacle", 27);
  96.                 NPCInfoVO._PropertyIndexDict.Add("IsSafe", 28);
  97.             }
  98.             return NPCInfoVO._PropertyIndexDict;
  99.         }
  100.     }
  101.  
  102.     public void CopyFrom(XElement xml)
  103.     {
  104.         this.ID = Global.GetXElementAttributeInt(xml, "ID");
  105.         this.PicCode = Global.GetXElementAttributeInt(xml, "PicCode");
  106.         this.ResName = Global.GetXElementAttributeStr(xml, "ResName");
  107.         this.YouShou = Global.GetXElementAttributeStr(xml, "YouShou");
  108.         this.ZuoShou = Global.GetXElementAttributeStr(xml, "ZuoShou");
  109.         this.Wing = Global.GetXElementAttributeStr(xml, "Wing");
  110.         this.FlyPet = Global.GetXElementAttributeStr(xml, "FlyPet");
  111.         this.Scale = Global.GetXElementAttributeFloat(xml, "Scale");
  112.         this.ShaderID = Global.GetXElementAttributeInt(xml, "ShaderID");
  113.         this.GuaJieDian = Global.GetXElementAttributeStr(xml, "GuaJieDian");
  114.         this.GuaJieTeXiao = Global.GetXElementAttributeStr(xml, "GuaJieTeXiao");
  115.         this.Function = Global.GetXElementAttributeStr(xml, "Function");
  116.         this.SName = Global.GetXElementAttributeStr(xml, "SName");
  117.         this.MapCode = Global.GetXElementAttributeInt(xml, "MapCode");
  118.         this.Talk = Global.GetXElementAttributeStr(xml, "Talk");
  119.         this.SaleID = Global.GetXElementAttributeStr(xml, "SaleID");
  120.         this.LuaScriptFile = Global.GetXElementAttributeStr(xml, "LuaScriptFile");
  121.         this.Display = Global.GetXElementAttributeInt(xml, "Display");
  122.         this.PlaySound = Global.GetXElementAttributeStr(xml, "PlaySound");
  123.         this.Interval = Global.GetXElementAttributeFloat(xml, "Interval");
  124.         this.TakeSound = Global.GetXElementAttributeStr(xml, "TakeSound");
  125.         string[] array = Global.GetXElementAttributeStr(xml, "Collide").Split(new char[]
  126.         {
  127.             ';'
  128.         });
  129.         if (array.Length == 2)
  130.         {
  131.             string[] array2 = array[0].Split(new char[]
  132.             {
  133.                 ','
  134.             });
  135.             this.CollideCenter = new Vector3(Convert.ToSingle(array2[0]), Convert.ToSingle(array2[1]), Convert.ToSingle(array2[2]));
  136.             array2 = array[1].Split(new char[]
  137.             {
  138.                 ','
  139.             });
  140.             this.CollideSize = new Vector3(Convert.ToSingle(array2[0]), Convert.ToSingle(array2[1]), Convert.ToSingle(array2[2]));
  141.             this.IsCollide = true;
  142.         }
  143.         array = Global.GetXElementAttributeStr(xml, "Obstacle").Split(new char[]
  144.         {
  145.             ','
  146.         });
  147.         if (array.Length == 2)
  148.         {
  149.             this.ObstacleX = Convert.ToInt32(array[0]);
  150.             this.ObstacleY = Convert.ToInt32(array[1]);
  151.         }
  152.         this.IsSafe = Global.GetXElementAttributeInt(xml, "IsSafe");
  153.     }
  154.  
  155.     public void CopyFrom(TrdGoodVOPairs pairs)
  156.     {
  157.         if (TrdGoodVOPairs.IsCopySpeedUp())
  158.         {
  159.             pairs.StartGoodVOCopySpeedUp();
  160.         }
  161.         this.ID = pairs.PropertyAtOfInt("ID");
  162.         this.PicCode = pairs.PropertyAtOfInt("PicCode");
  163.         this.ResName = pairs.PropertyAtOfStr("ResName");
  164.         this.YouShou = pairs.PropertyAtOfStr("YouShou");
  165.         this.ZuoShou = pairs.PropertyAtOfStr("ZuoShou");
  166.         this.Wing = pairs.PropertyAtOfStr("Wing");
  167.         this.FlyPet = pairs.PropertyAtOfStr("FlyPet");
  168.         this.Scale = float.Parse(pairs.PropertyAtOfStr("Scale"));
  169.         this.ShaderID = pairs.PropertyAtOfInt("ShaderID");
  170.         this.GuaJieDian = pairs.PropertyAtOfStr("GuaJieDian");
  171.         this.GuaJieTeXiao = pairs.PropertyAtOfStr("GuaJieTeXiao");
  172.         this.Function = pairs.PropertyAtOfStr("Function");
  173.         this.SName = pairs.PropertyAtOfStr("SName");
  174.         this.MapCode = pairs.PropertyAtOfInt("MapCode");
  175.         this.Talk = pairs.PropertyAtOfStr("Talk");
  176.         this.SaleID = pairs.PropertyAtOfStr("SaleID");
  177.         this.LuaScriptFile = pairs.PropertyAtOfStr("LuaScriptFile");
  178.         this.Display = pairs.PropertyAtOfInt("Display");
  179.         this.PlaySound = pairs.PropertyAtOfStr("PlaySound");
  180.         this.Interval = (float)ConvertExt.SafeConvertToDouble(pairs.PropertyAtOfStr("Interval"));
  181.         this.TakeSound = pairs.PropertyAtOfStr("TakeSound");
  182.         string[] array = pairs.PropertyAtOfStr("Collide").Split(new char[]
  183.         {
  184.             ';'
  185.         });
  186.         if (array.Length == 3)
  187.         {
  188.             string[] array2 = array[0].Split(new char[]
  189.             {
  190.                 ','
  191.             });
  192.             this.CollideCenter = new Vector3(Convert.ToSingle(array2[0]), Convert.ToSingle(array2[1]), Convert.ToSingle(array2[2]));
  193.             array2 = array[1].Split(new char[]
  194.             {
  195.                 ','
  196.             });
  197.             this.CollideSize = new Vector3(Convert.ToSingle(array2[0]), Convert.ToSingle(array2[1]), Convert.ToSingle(array2[2]));
  198.             int num = ConvertExt.SafeConvertToInt32(array[2]);
  199.             this.IsCollide = (num == 1);
  200.         }
  201.         string[] array3 = pairs.PropertyAtOfStr("Obstacle").Split(new char[]
  202.         {
  203.             ','
  204.         });
  205.         if (array3.Length == 2)
  206.         {
  207.             this.ObstacleX = Convert.ToInt32(array3[0]);
  208.             this.ObstacleY = Convert.ToInt32(array3[1]);
  209.         }
  210.         this.IsSafe = pairs.PropertyAtOfInt("IsSafe");
  211.     }
  212.  
  213.     public List<byte> ToByteLst(NPCInfoVO preVO, NPCInfoVO curVO)
  214.     {
  215.         return new List<byte>();
  216.     }
  217.  
  218.     public bool Equals(NPCInfoVO obj)
  219.     {
  220.         if (obj == null)
  221.         {
  222.             MUDebug.LogError<string>(new string[]
  223.             {
  224.                 "dest is null"
  225.             });
  226.             return false;
  227.         }
  228.         return true;
  229.     }
  230. }
Advertisement
Add Comment
Please, Sign In to add comment