Exemplo n.º 1
0
    /// <summary>
    /// 递归遍历所有初始UI节点,将其加入uiNodes字典,以便后面查找父节点
    /// </summary>
    /// <param name="trans"></param>
    private void RecurseAllUIElements(Transform trans)
    {
        int childCount = trans.childCount;

        for (int i = 0; i < childCount; i++)
        {
            Transform child = trans.GetChild(i);
            if (child.GetComponent <InfoNode>() == null)
            {
                Debug.Log("UI元素:" + child.name + "没有挂载InfoNode脚本!");
            }
            else
            {
                InfoNode node = child.GetComponent <InfoNode>();
                if (!uiNodes.ContainsKey(node.GetNodeIdOfName(currentUIName)))
                {
                    uiNodes.Add(node.GetNodeIdOfName(currentUIName), child);
                }
                else
                {
                    Debug.Log("存在重复的UiNode,重复序号为:" + node.GetNodeIdOfName(currentUIName) + ",名字为:" + child.name);
                }
            }
            RecurseAllUIElements(child);
        }
    }
Exemplo n.º 2
0
    private void RecurseAllMapElements(Transform root, string mapName)
    {
        int childCount = root.childCount;

        for (int i = 0; i < childCount; i++)
        {
            Transform child = root.GetChild(i);
            if (child.GetComponent <InfoNode>() == null)
            {
                Debug.Log("map元素:" + child.name + "没有挂载InfoNode脚本!");
            }
            else
            {
                InfoNode node = child.GetComponent <InfoNode>();
                if (!mapNodes.ContainsKey(node.GetNodeIdOfName(mapName)))
                {
                    mapNodes.Add(node.GetNodeIdOfName(mapName), child);
                }
                else
                {
                    Debug.Log("存在重复的MapNode,重复序号为:" + node.GetNodeIdOfName(mapName) + ",名字为:" + child.name);
                }
            }
            RecurseAllMapElements(child, mapName);
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// 加载地图碰撞数据
    /// </summary>
    /// <param name="mapId"></param>
    /// <returns></returns>
    public MapDataNode LoadMapCollider(int mapId)
    {
        if (!m_mapDataDic.ContainsKey(mapId))
        {
            UnityEngine.Debug.Log("MapDataManage.cs  --- 22 !m_mapDataDic.ContainsKey(mapId)");
            return(null);
        }
        MapDataNode mapdata = m_mapDataDic[mapId];

        UnityEngine.Debug.Log("MapDataManage.cs  ---  mapdata" + mapId + ":" + mapdata.Name);
        // 读地图Collider
        InfoNodeList viList = InfoNodeHelper.ReadFromCSV(GlobalVarFun.m_streamAssets + "MAP/" + mapId + ".csv");

        string[] arrKeys = viList.m_nodeList.Keys.ToArray();
        for (int i = 0; i < viList.Count; i++)
        {
            InfoNode vi = viList.m_nodeList[arrKeys[i]];
            if (vi != null)
            {
                mapdata.CreateCollider(vi);
            }
        }
        mapdata.HasLoaded = true;
        return(mapdata);
    }
Exemplo n.º 4
0
        private static SceneNode LoadINF1FromFile(SceneNode rootNode, EndianBinaryReader reader, long chunkStart)
        {
            ushort unknown1            = reader.ReadUInt16(); // A lot of Link's models have it but no idea what it means. Alt. doc says: "0 for BDL, 01 for BMD"
            ushort padding             = reader.ReadUInt16();
            uint   packetCount         = reader.ReadUInt32(); // Total number of Packets across all Batches in file.
            uint   vertexCount         = reader.ReadUInt32(); // Total number of vertexes across all batches within the file.
            uint   hierarchyDataOffset = reader.ReadUInt32();

            // The Hierarchy defines how Joints, Materials and Shapes are laid out. This allows them to bind a material
            // and draw multiple shapes (batches) with the material. It also complicates drawing things, but whatever.
            reader.BaseStream.Position = chunkStart + hierarchyDataOffset;

            List <InfoNode> infoNodes = new List <InfoNode>();
            InfoNode        curNode   = null;

            do
            {
                curNode       = new InfoNode();
                curNode.Type  = (HierarchyDataTypes)reader.ReadUInt16();
                curNode.Value = reader.ReadUInt16(); // "Index into Joint, Material, or Shape table.

                infoNodes.Add(curNode);
            }while (curNode.Type != HierarchyDataTypes.Finish);

            ConvertInfoHiearchyToSceneGraph(ref rootNode, infoNodes, 0);
            return(rootNode);
        }
Exemplo n.º 5
0
 public InfoNode(Node node)
 {
     this.node = node;
     this.prev = null;
     this.dist = float.MaxValue;
     Q.AddLast(this);
 }
Exemplo n.º 6
0
    /// <summary>
    /// 初始化DamageDataManager 其实是加载DamageData文件
    /// </summary>
    public void Init()
    {
        // 读取数据
        InfoNodeList viList = InfoNodeHelper.ReadFromCSV(GlobalVarFun.m_streamAssets + "Battle/DamageBodyData.csv");

        if (null == viList)
        {
            m_bIsInited = false;
            return;
        }

        string[] arrKeys = viList.m_nodeList.Keys.ToArray();
        for (int i = 0; i < viList.Count; i++)
        {
            InfoNode vi = viList.m_nodeList[arrKeys[i]];
            if (vi != null)
            {
                DamageBodyInfo dbData = new DamageBodyInfo(vi);
                m_damageDataDic.Add(dbData.ID, dbData);

                UnityEngine.Debug.Log("DamageDataManager.cs  ---  LoadAllDamageBodyData : " + dbData.ID + " : " + dbData.Name);
            }
        }
        m_bIsInited = true;
    }
Exemplo n.º 7
0
    /// <summary>
    /// 利用传入的map元素信息新建一个map元素,并根据信息对其初始化,再加入节点字典
    /// </summary>
    /// <param name="info"></param>
    public GameObject NewMapElement(Object obj)
    {
        GameObject go   = (GameObject)Instantiate(obj);
        InfoNode   node = go.GetComponent <InfoNode>();

        if (node == null)
        {
            Debug.Log("Map元素预设未挂载GameObjNodeInfo脚本,实例化失败!");
            Destroy(go);
            return(null);
        }


        int parentId = node.GetParentIdOfName(currentMapName);

        if (parentId == 0)
        {
            go.transform.parent = mapRoot;
        }
        else
        {
            if (mapNodes.ContainsKey(parentId))
            {
                go.transform.parent = mapNodes[parentId];
            }
            else
            {
                Debug.Log("没有找到Map元素:" + go.name + "的父节点:" + parentId);
                Destroy(go);
                return(null);
            }
        }

        if (!mapNodes.ContainsKey(node.GetNodeIdOfName(currentMapName)))
        {
            mapNodes.Add(node.GetNodeIdOfName(currentMapName), go.transform);
        }
        else
        {
            Debug.Log("Map中已存在相同的元素:" + go.name + ",请检查重复调用!");
            Destroy(go);
            return(null);
        }

        RecurseAllMapElements(go.transform, currentMapName);

        GameObjInfo[] goInfos = go.GetComponents <GameObjInfo>();
        foreach (GameObjInfo info in goInfos)
        {
            if (info.IndexName == currentMapName)
            {
                info.SetGameObj();
                break;
            }
        }

        return(go);
    }
Exemplo n.º 8
0
        void _AppendNode(InfoNode i, TreeNode super)
        {
            if (i.DType == DataType.Error)
            {
                i.ForeColor = Color.Red;
            }

            super.Nodes.Add(i);
        }
Exemplo n.º 9
0
 private void UpdateNode(InfoNode node)
 {
     client.Cypher.MatchQuerry("n", node)
     .Set("n.NextNodeId = {NextNodeId}")
     .WithParam("NextNodeId", node.NextNodeId)
     .Set("n.NextEdgeId = {NextEdgeId}")
     .WithParam("NextEdgeId", node.NextEdgeId)
     .ExecuteWithoutResults();
 }
Exemplo n.º 10
0
    /// <summary>
    /// 利用传入的ui元素信息新建一个UI元素,并根据信息对其初始化,再加入节点字典
    /// </summary>
    /// <param name="info"></param>
    public GameObject NewUIElement(Object obj)
    {
        GameObject go   = (GameObject)Instantiate(obj);
        InfoNode   node = go.GetComponent <InfoNode>();

        if (node == null)
        {
            Debug.Log("UI元素预设未挂载InfoNode脚本,实例化失败!");
            Destroy(go);
            return(null);
        }


        int parentId = node.GetParentIdOfName(currentUIName);

        if (parentId == 0)
        {
            go.transform.SetParent(UI.transform);
        }
        else
        {
            if (uiNodes.ContainsKey(parentId))
            {
                go.transform.SetParent(uiNodes[parentId]);
            }
            else
            {
                Debug.Log("没有找到UI元素:" + go.name + "的父节点:" + parentId);
                Destroy(go);
                return(null);
            }
        }

        if (!uiNodes.ContainsKey(node.GetNodeIdOfName(currentUIName)))
        {
            uiNodes.Add(node.GetNodeIdOfName(currentUIName), go.transform);
        }
        else
        {
            Debug.Log("UI界面中已存在相同的元素:" + go.name + ",请检查重复调用!");
            Destroy(go);
            return(null);
        }

        RecurseAllUIElements(go.transform);

        foreach (RecTransformInfo info in go.GetComponents <RecTransformInfo>())
        {
            if (info.IndexName == currentUIName)
            {
                info.SetRecTransform();
                break;
            }
        }
        return(go);
    }
Exemplo n.º 11
0
    public void CreateCollider(InfoNode node)
    {
        ColliderDataNode colliderdata = new ColliderDataNode(node);

        if (m_colliderDatas == null)
        {
            m_colliderDatas = new List <ColliderDataNode>();
        }
        m_colliderDatas.Add(colliderdata);
    }
Exemplo n.º 12
0
 public BaseRoleInfo(InfoNode vi)
 {
     RoleID     = vi.GetValueInt("ID");
     Name       = vi.GetValue("NAME");
     PrefabName = vi.GetValue("PREFABNAME");
     Sex        = vi.GetValueInt("SEX");
     MaxHp      = vi.GetValueInt("MAXHP");
     Attack     = vi.GetValueInt("ATTACK");
     Width      = vi.GetValueFloat("WIDTH");
     Height     = vi.GetValueFloat("HEIGHT");
     VelocityX  = vi.GetValueFloat("VELX");
     VelocityY  = vi.GetValueFloat("VELY");
     BaseInfo   = vi;
 }
Exemplo n.º 13
0
 public MapRoleInfo(InfoNode vi)
 {
     ID         = vi.GetValueInt("ID");
     RoleID     = vi.GetValueInt("ROLEID");
     RoleType   = vi.GetValueInt("ROLETYPE");
     InitPosX   = vi.GetValueFloat("INITPOSX");
     InitPosY   = vi.GetValueFloat("INITPOSY");
     InitHP     = vi.GetValueInt("CURHP");
     InitStatus = vi.GetValueInt("STATUS");
     IsStatic   = vi.GetValueBool("ISSTATIC");
     CanMove    = vi.GetValueBool("CANMOVE");
     CanControl = vi.GetValueBool("CANCONTROL");
     BaseInfo   = vi;
 }
Exemplo n.º 14
0
    private void parseUserNode(InfoNode _caller, HtmlNode _localNode)
    {
        ;
        HtmlNodeCollection coll;

        ;
        saveNodeToFile(node);

        coll = _localNode.SelectNodes(_localNode.XPath + @"/a/span[@class]");  //user online
        foreach (HtmlNode localSubNode in coll)
        {
            parseNode(_caller, localSubNode);
        }
    }
Exemplo n.º 15
0
 public DamageBodyInfo(InfoNode vi)
 {
     ID           = 1;
     DamageType   = (int)eDamageBodyType.Damage;
     MoveType     = (int)eDamageMoveType.Linear;
     Name         = "123";
     PrefabName   = "Damage/Damage1";
     Width        = 1;
     Height       = 1;
     OffsetX      = 0;
     OffsetY      = 0;
     DamageValue  = 10;
     EsTime       = -1;
     MoveVelocity = 5;
 }
Exemplo n.º 16
0
    Stack <Node> UniCostSearchPath(Node start, T target)
    {
        InfoNode.Q = new LinkedList <InfoNode>();
        DFS(start, (Node node) => InfoNode.Q.AddLast(new InfoNode(node)));
        InfoNode source         = InfoNode.Q.First.Value;
        InfoNode targetInfoNode = null;

        source.dist = 0f;

        while (!InfoNode.IsOver())
        {
            LinkedListNode <InfoNode> u = InfoNode.UniformCostFIndMinInQ();
            if (EqualityComparer <T> .Default.Equals(u.Value.node.Value, target))
            {
                targetInfoNode = u.Value;
                break;
            }
            InfoNode.Q.Remove(u);
            Node uNode = u.Value.node;
            int  len   = uNode.NumberOfNeighbors;
            for (int i = 0; i < len; i++)
            {
                InfoNode v = InfoNode.FindInQ(uNode[i]);
                if (v != null)
                {
                    float alt = u.Value.dist + uNode.DistanceToNeighbor(i);
                    if (alt < v.dist)
                    {
                        v.dist = alt;
                        v.prev = u.Value;
                    }
                }
            }
        }
        if (targetInfoNode == null)
        {
            return(null);
        }
        Stack <Node> stack = new Stack <Node>();

        while (targetInfoNode.prev != null)
        {
            stack.Push(targetInfoNode.node);
            targetInfoNode = targetInfoNode.prev;
        }
        return(stack);
    }
Exemplo n.º 17
0
        /// <summary>
        /// This function is used to convert from a flat-file of J3DFileResource.InfoNodes into a treeview-type version of SceneNode.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="allNodes"></param>
        /// <param name="currentListIndex"></param>
        /// <returns></returns>
        private static int ConvertInfoHiearchyToSceneGraph(ref SceneNode parent, List <InfoNode> allNodes, int currentListIndex)
        {
            for (int i = currentListIndex; i < allNodes.Count; i++)
            {
                InfoNode  curNode = allNodes[i];
                SceneNode newNode = new SceneNode();

                switch (curNode.Type)
                {
                case HierarchyDataTypes.NewNode:
                    // Increase the depth of the hierarchy by creating a new node and then processing all of the next nodes as its children.
                    // This function is recursive and will return the integer value of how many nodes it processed, this allows us to skip
                    // the list forward that many now that they've been handled.
                    newNode.Type  = HierarchyDataTypes.NewNode;
                    newNode.Value = curNode.Value;

                    i += ConvertInfoHiearchyToSceneGraph(ref newNode, allNodes, i + 1);
                    parent.Children.Add(newNode);
                    break;

                case HierarchyDataTypes.EndNode:
                    // Alternatively, if it's a EndNode, that's our signal to go up a level. We return the number of nodes that were processed between the last NewNode
                    // and this EndNode at this depth in the hierarchy.
                    return(i - currentListIndex + 1);

                case HierarchyDataTypes.Material:
                case HierarchyDataTypes.Joint:
                case HierarchyDataTypes.Batch:
                case HierarchyDataTypes.Finish:

                    // If it's any of the above we simply create a node for them. We create and pull from a different InfoNode because
                    // Hitting a NewNode can modify the value of i so curNode is now no longer valid.
                    InfoNode thisNode = allNodes[i];
                    newNode.Type  = thisNode.Type;
                    newNode.Value = thisNode.Value;
                    parent.Children.Add(newNode);
                    break;

                default:
                    WLog.Warning(LogCategory.ModelLoading, null, "Unsupported HierarchyDataType \"{0}\" in model!", curNode.Type);
                    break;
                }
            }

            return(0);
        }
Exemplo n.º 18
0
 public MapDataNode(InfoNode node)
 {
     ID           = node.GetValueInt("ID");
     Name         = node.GetValue("NAME");
     Type         = (eMapAreaType)node.GetValueInt("TYPE");
     ScaleRatio   = node.GetValueFloat("SCALERATIO");
     SmallMapName = node.GetValue("SMALLMAP");
     MapMusicName = node.GetValue("BGM");
     MapAreaMinX  = node.GetValueFloat("MINX");
     MapAreaMaxX  = node.GetValueFloat("MAXX");
     MapAreaMinY  = node.GetValueFloat("MINY");
     MapAreaMaxY  = node.GetValueFloat("MAXY");
     MoodDecrease = node.GetValueFloat("MOODDEC");
     InitPosX     = node.GetValueFloat("INITPOSX");
     InitPosY     = node.GetValueFloat("INITPOSY");
     Width        = (int)(MapAreaMaxX - MapAreaMinX) + 1;
     Height       = (int)(MapAreaMaxY - MapAreaMinY) + 1;
 }
Exemplo n.º 19
0
        internal InfoNode WriteOrUpdateInfoNode(string repoCloneFolder, string analysisDestination)
        {
            var info = this.GetInfoNode();

            if (info == null)
            {
                var n = new InfoNode(1)
                {
                    CloneFolder = repoCloneFolder, AnalysisFolder = repoCloneFolder, NextNodeId = 2, NextEdgeId = 1
                };
                WriteNode(n);
                info = this.GetInfoNode();
            }

            this.nextNodeId = info.NextNodeId;
            this.nextEdgeId = info.NextEdgeId;
            return(info);
        }
Exemplo n.º 20
0
 protected override void OnMouseDown(MouseEventArgs mevent)
 {
     base.OnMouseDown(mevent);
     if (mevent.Clicks >= 2)
     {
         InfoNode infoNode = InfoNode.GetInstance();
         infoNode.SetData(this);
         infoNode.ShowDialog();
         infoNode.SetAgainData(this);
         Simulation.writeToItemSettingFile(this);
         infoNode.i = 0;
     }
     if (mevent.Button == MouseButtons.Right)
     {
         delete del = new delete();
         del.ShowDialog();
     }
     capture = true;
 }
Exemplo n.º 21
0
    /// <summary>
    /// 初始化MapDataManage 其实是加载AllMapData文件(暂不用)
    /// </summary>
    public void Init()
    {
        // 读取数据
        InfoNodeList viList = InfoNodeHelper.ReadFromCSV(GlobalVarFun.m_streamAssets + "Map/AllMapData.csv");

        string[] arrKeys = viList.m_nodeList.Keys.ToArray();
        for (int i = 0; i < viList.Count; i++)
        {
            InfoNode vi = viList.m_nodeList[arrKeys[i]];
            if (vi != null)
            {
                MapDataNode mapdata = new MapDataNode(vi);
                m_mapDataDic.Add(mapdata.ID, mapdata);

                //UnityEngine.Debug.Log("MapDataManage.cs  ---  LoadAllMapData : " + mapdata.ID + " : " + mapdata.Name);
            }
        }
        m_bIsInited = true;
    }
Exemplo n.º 22
0
        private int BuildSceneGraphFromInfoNodes(ref HierarchyNode parent, List <InfoNode> allNodes, int currentListIndex)
        {
            for (int i = currentListIndex; i < allNodes.Count; i++)
            {
                InfoNode      curNode = allNodes[i];
                HierarchyNode newNode = null;

                switch (curNode.Type)
                {
                case HierarchyDataType.NewNode:
                    // Increase the depth of the hierarchy by getting the latest child we have added to the mesh, and then processing the next
                    // nodes as its children. This function is recursive and will return the integer value of how many nodes it processed, this
                    // allows us to skip the list forward that many now that they've been handled.
                    HierarchyNode latestChild = parent.Children[parent.Children.Count - 1];
                    i += BuildSceneGraphFromInfoNodes(ref latestChild, allNodes, i + 1);
                    break;

                case HierarchyDataType.EndNode:
                    // Alternatively, if it's a EndNode, that's our signal to go up a level. We return the number of nodes that were processed between the last NewNode
                    // and this EndNode at this depth in the hierarchy.
                    return(i - currentListIndex + 1);

                case HierarchyDataType.Material:
                case HierarchyDataType.Joint:
                case HierarchyDataType.Batch:
                case HierarchyDataType.Finish:

                    // If it's any of the above we simply create a node for them. We create and pull from a different InfoNode because
                    // Hitting a NewNode can modify the value of i so curNode is now no longer valid.
                    InfoNode thisNode = allNodes[i];
                    newNode = new HierarchyNode(thisNode.Type, thisNode.Value);
                    parent.Children.Add(newNode);
                    break;

                default:
                    Console.WriteLine("Unsupported HierarchyDataType \"{0}\" in model!", curNode.Type);
                    break;
                }
            }

            return(0);
        }
Exemplo n.º 23
0
        public static void GlobalVariablesEntryType(Stream stream, TreeNode parent, ref byte[] buffer)
        {
            uint count = ESS.ReadVarLenBasic(stream, "Array count", (InfoNode)parent, ref buffer);

            for (int i = 0; i < count; i++)
            {
                InfoNode nStat = new InfoNode(
                    "", "block-trueblue",
                    InfoType.None,
                    null,
                    DataType.Critical,
                    stream.Position, 0);

                nStat.Text = ESS.ReadRefIDBasic(stream, "FormID", nStat, ref buffer).ToString("X6");
                ESS.ReadFloatBasic(stream, "Value", nStat, ref buffer);

                nStat.DataEnd = stream.Position - 1;
                Bridge.AppendNode(nStat, parent);
            }
        }
Exemplo n.º 24
0
        public static void MiscStatsEntryType(Stream stream, TreeNode parent, ref byte[] buffer)
        {
            uint count = ESS.ReadUInt32Basic(stream, "Array count", parent, ref buffer);

            for (int i = 0; i < count; i++)
            {
                InfoNode nStat = new InfoNode(
                    "", "block-trueblue",
                    InfoType.None,
                    null,
                    DataType.Critical,
                    stream.Position, 0);

                nStat.Text = ESS.ReadWStringBasic(stream, "Stat name", nStat, ref buffer);
                ESS.ReadUInt8Basic(stream, "Category", nStat, ref buffer);
                ESS.ReadUInt32Basic(stream, "Value", nStat, ref buffer);

                nStat.DataEnd = stream.Position - 1;
                Bridge.AppendNode(nStat, parent);
            }
        }
Exemplo n.º 25
0
    public void parseNode(InfoNode _caller, HtmlNode _node)
    {
        string _str;

        if (_node.HasAttributes)
        {
            foreach (HtmlAttribute attr in _node.Attributes)
            {
                switch (attr.Value)
                {
                case "user":
                    parseUserNode(_caller, _node);
                    break;

                case "":
                    _caller.Online = (bool)true;
                    _caller.Name   = cleanNodeInnerText(_node);
                    break;

                case "c_66":
                    _caller.Online = (bool)false;
                    _caller.Name   = cleanNodeInnerText(_node);
                    break;

                case "c_99":
                    _str       = cleanNodeInnerText(_node);
                    _caller.XP = Convert.ToInt64(_str);
                    break;

                case "c_66 ml21":
                    _caller.Title = cleanNodeInnerText(_node);
                    break;

                default:
                    break;
                }
            }
        }
    }
Exemplo n.º 26
0
    /// <summary>
    /// 递归遍历所有子节点,将每个节点的hierachy信息存储到InfoNode脚本,并将脚本挂载上去
    /// </summary>
    /// <param name="trans"></param>
    private static void recurseNodes(Transform trans, string indexName)
    {
        int childCount = trans.childCount;

        for (int i = 0; i < childCount; i++)
        {
            Transform child = trans.GetChild(i);
            if (child.GetComponent <InfoNode>() == null)
            {
                child.gameObject.AddComponent <InfoNode>();
            }
            InfoNode node     = child.gameObject.GetComponent <InfoNode>();
            int      parentId = 0;
            if (trans.GetComponent <InfoNode>() != null)
            {
                parentId = trans.GetComponent <InfoNode>().GetNodeIdOfName(indexName);
            }
            node.SetNodeOfName(indexName, atInt.GetIncrease(), parentId, child.GetSiblingIndex());

            recurseNodes(child, indexName);
        }
    }
Exemplo n.º 27
0
        public void LoadINF1FromStream(EndianBinaryReader reader, long chunkStart)
        {
            Unknown1 = reader.ReadUInt16();    //
            reader.Skip(2);                    // Padding
            PacketCount = reader.ReadUInt32(); // Total Number of Packets across all Batches in file.
            VertexCount = reader.ReadUInt32(); // Total Number of Vertices across all batches within file.
            uint hierarchyDataOffset = reader.ReadUInt32();

            reader.BaseStream.Position = chunkStart + hierarchyDataOffset;

            List <InfoNode> infoNodes = new List <InfoNode>();
            InfoNode        curNode   = null;

            do
            {
                curNode = new InfoNode((HierarchyDataType)reader.ReadUInt16(), reader.ReadUInt16());
                infoNodes.Add(curNode);
            }while (curNode.Type != HierarchyDataType.Finish);

            m_hierarchy = new HierarchyNode();
            BuildSceneGraphFromInfoNodes(ref m_hierarchy, infoNodes, 0);
        }
Exemplo n.º 28
0
    static public InfoNodeList ReadFromCSV(string fileName)
    {
        //
        string content = LoadCSVToString(fileName);

        if (string.IsNullOrEmpty(content))
        {
            return(null);
        }

        string[] arrLine = content.Split('\n');
        if (null == arrLine)
        {
            return(null);
        }

        InfoNodeList reta = new InfoNodeList();

        string[] arrKey = arrLine[1].Remove(arrLine[1].Length - 1).Split(',');
        for (int i = 2; i < arrLine.Length; i++)
        {
            string strLine = arrLine[i];
            if (string.IsNullOrEmpty(strLine))
            {
                continue;
            }
            strLine = strLine.Remove(arrLine[i].Length - 1);
            string[] arrWord = strLine.Split(',');

            InfoNode node = new InfoNode();
            for (int j = 0; j < arrKey.Length; j++)
            {
                node.SetValue(arrKey[j], arrWord[j]);
            }
            reta.m_nodeList.Add(arrWord[0], node); // 默认第一列为key
        }
        return(reta);
    }
Exemplo n.º 29
0
        private void contextTreeDump_Click(object sender, EventArgs e)
        {
            if (!(tree.SelectedNode is InfoNode))
            {
                return;
            }
            InfoNode inode = (InfoNode)tree.SelectedNode;

            if (inode.IType != InfoType.Binary && inode.IType != InfoType.BinaryMainFocus)
            {
                return;
            }

            string location = null;

            using (SaveFileDialog sfd = new SaveFileDialog())
            {
                sfd.Filter = "Binary files (*.bin)|*.bin";
                if (sfd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                location = sfd.FileName;
            }

            if (String.IsNullOrWhiteSpace(location))
            {
                return;
            }

            byte[] info = (byte[])inode.Info;
            using (FileStream fs = File.Open(location, FileMode.Create))
            {
                fs.Write(info, 0, info.Length);
            }

            MessageBox.Show(this, $"{info.Length} bytes of data successfully written to '{Path.GetFileName(location)}'", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Exemplo n.º 30
0
    /// <summary>
    /// 加载当前Map的所有Role数据
    /// </summary>
    /// <param name="mapId"></param>
    public List <MapRoleInfo> GetMapRoleData(int mapId)
    {
        // 读取数据
        InfoNodeList viList = InfoNodeHelper.ReadFromCSV(GlobalVarFun.m_streamAssets + "Role/" + mapId + ".csv");

        if (null == viList)
        {
            return(null);
        }

        List <MapRoleInfo> mapRoleInfo = new List <MapRoleInfo>();

        string[] arrKeys = viList.m_nodeList.Keys.ToArray();
        for (int i = 0; i < viList.Count; i++)
        {
            InfoNode vi = viList.m_nodeList[arrKeys[i]];
            if (vi != null)
            {
                MapRoleInfo roleData = new MapRoleInfo(vi);
                mapRoleInfo.Add(roleData);
            }
        }
        return(mapRoleInfo);
    }
Exemplo n.º 31
0
		public static List<AbstractNode> GetDebugInfo(Process process, ICorDebugValue corValue)
		{
			List<AbstractNode> items = new List<AbstractNode>();
			
			if (corValue.Is<ICorDebugValue>()) {
				InfoNode info = new InfoNode("ICorDebugValue", "");
				info.AddChild("Address", corValue.Address.ToString("X8"));
				info.AddChild("Type", ((CorElementType)corValue.Type).ToString());
				info.AddChild("Size", corValue.Size.ToString());
				items.Add(info);
			}
			if (corValue.Is<ICorDebugValue2>()) {
				InfoNode info = new InfoNode("ICorDebugValue2", "");
				ICorDebugValue2 corValue2 = corValue.CastTo<ICorDebugValue2>();
				string fullname;
				try {
					fullname = DebugType.Create(process, corValue2.ExactType).FullName;
				} catch (DebuggerException e) {
					fullname = e.Message;
				}
				info.AddChild("ExactType", fullname);
				items.Add(info);
			}
			if (corValue.Is<ICorDebugGenericValue>()) {
				InfoNode info = new InfoNode("ICorDebugGenericValue", "");
				try {
					byte[] bytes = corValue.CastTo<ICorDebugGenericValue>().RawValue;
					for(int i = 0; i < bytes.Length; i += 8) {
						string val = "";
						for(int j = i; j < bytes.Length && j < i + 8; j++) {
							val += bytes[j].ToString("X2") + " ";
						}
						info.AddChild("Value" + i.ToString("X2"), val);
					}
				} catch (ArgumentException) {
					info.AddChild("Value", "N/A");
				}
				items.Add(info);
			}
			if (corValue.Is<ICorDebugReferenceValue>()) {
				InfoNode info = new InfoNode("ICorDebugReferenceValue", "");
				ICorDebugReferenceValue refValue = corValue.CastTo<ICorDebugReferenceValue>();
				info.AddChild("IsNull", (refValue.IsNull != 0).ToString());
				if (refValue.IsNull == 0) {
					info.AddChild("Value", refValue.Value.ToString("X8"));
					if (refValue.Dereference() != null) {
						info.AddChild("Dereference", "", GetDebugInfo(process, refValue.Dereference()));
					} else {
						info.AddChild("Dereference", "N/A");
					}
					
				}
				items.Add(info);
			}
			if (corValue.Is<ICorDebugHeapValue>()) {
				InfoNode info = new InfoNode("ICorDebugHeapValue", "");
				items.Add(info);
			}
			if (corValue.Is<ICorDebugHeapValue2>()) {
				InfoNode info = new InfoNode("ICorDebugHeapValue2", "");
				items.Add(info);
			}
			if (corValue.Is<ICorDebugObjectValue>()) {
				InfoNode info = new InfoNode("ICorDebugObjectValue", "");
				ICorDebugObjectValue objValue = corValue.CastTo<ICorDebugObjectValue>();
				info.AddChild("Class", objValue.Class.Token.ToString("X8"));
				info.AddChild("IsValueClass", (objValue.IsValueClass != 0).ToString());
				items.Add(info);
			}
			if (corValue.Is<ICorDebugObjectValue2>()) {
				InfoNode info = new InfoNode("ICorDebugObjectValue2", "");
				items.Add(info);
			}
			if (corValue.Is<ICorDebugBoxValue>()) {
				InfoNode info = new InfoNode("ICorDebugBoxValue", "");
				ICorDebugBoxValue boxValue = corValue.CastTo<ICorDebugBoxValue>();
				info.AddChild("Object", "", GetDebugInfo(process, boxValue.Object.CastTo<ICorDebugValue>()));
				items.Add(info);
			}
			if (corValue.Is<ICorDebugStringValue>()) {
				InfoNode info = new InfoNode("ICorDebugStringValue", "");
				ICorDebugStringValue stringValue = corValue.CastTo<ICorDebugStringValue>();
				info.AddChild("Length", stringValue.Length.ToString());
				info.AddChild("String", stringValue.String);
				items.Add(info);
			}
			if (corValue.Is<ICorDebugArrayValue>()) {
				InfoNode info = new InfoNode("ICorDebugArrayValue", "");
				info.AddChild("...", "...");
				items.Add(info);
			}
			if (corValue.Is<ICorDebugHandleValue>()) {
				InfoNode info = new InfoNode("ICorDebugHandleValue", "");
				ICorDebugHandleValue handleValue = corValue.CastTo<ICorDebugHandleValue>();
				info.AddChild("HandleType", handleValue.HandleType.ToString());
				items.Add(info);
			}
			
			return items;
		}
Exemplo n.º 32
0
 void addItemElements(InfoNode pNode)
 {
     foreach (var lElement in pNode.elements)
     {
         addItemElement(lElement);
     }
     foreach (var lNode in pNode.nodes)
     {
         typeToNode[lNode.name] = lNode;
         addItemElements(lNode);
     }
 }
Exemplo n.º 33
0
    void creatNameToPrefab(InfoNode pInfoNode)
    {
        var lElements = pInfoNode.elements;
        for (int i = 0; i < lElements.Length; ++i)
        {
            var lElement = lElements[i];
            if (lElement.data)
            {
                nameToPrefab[lElement.name] = (GameObject)lElement.data;
            }
        }

        var lNodes = pInfoNode.nodes;
        for (int i = 0; i < lNodes.Length; ++i)
        {
            creatNameToPrefab(lNodes[i]);
        }
    }
Exemplo n.º 34
0
        private static SceneNode LoadINF1FromFile(SceneNode rootNode, EndianBinaryReader reader, long chunkStart)
        {
            ushort unknown1 = reader.ReadUInt16(); // A lot of Link's models have it but no idea what it means. Alt. doc says: "0 for BDL, 01 for BMD"
            ushort padding = reader.ReadUInt16();
            uint packetCount = reader.ReadUInt32(); // Total number of Packets across all Batches in file.
            uint vertexCount = reader.ReadUInt32(); // Total number of vertexes across all batches within the file.
            uint hierarchyDataOffset = reader.ReadUInt32();

            // The Hierarchy defines how Joints, Materials and Shapes are laid out. This allows them to bind a material
            // and draw multiple shapes (batches) with the material. It also complicates drawing things, but whatever.
            reader.BaseStream.Position = chunkStart + hierarchyDataOffset;

            List<InfoNode> infoNodes = new List<InfoNode>();
            InfoNode curNode = null;

            do
            {
                curNode = new InfoNode();
                curNode.Type = (HierarchyDataTypes)reader.ReadUInt16();
                curNode.Value = reader.ReadUInt16(); // "Index into Joint, Material, or Shape table.

                infoNodes.Add(curNode);
            }
            while (curNode.Type != HierarchyDataTypes.Finish);

            ConvertInfoHiearchyToSceneGraph(ref rootNode, infoNodes, 0);
            return rootNode;
        }
Exemplo n.º 35
0
		public static List<TreeNode> GetDebugInfo(AppDomain appDomain, ICorDebugValue corValue)
		{
			List<TreeNode> items = new List<TreeNode>();
			
			if (corValue is ICorDebugValue) {
				InfoNode info = new InfoNode("ICorDebugValue", "");
				info.AddChild("Address", corValue.GetAddress().ToString("X8"));
				info.AddChild("Type", ((CorElementType)corValue.GetTheType()).ToString());
				info.AddChild("Size", corValue.GetSize().ToString());
				items.Add(info);
			}
			if (corValue is ICorDebugValue2) {
				InfoNode info = new InfoNode("ICorDebugValue2", "");
				ICorDebugValue2 corValue2 = (ICorDebugValue2)corValue;
				string fullname;
				try {
					fullname = DebugType.CreateFromCorType(appDomain, corValue2.GetExactType()).FullName;
				} catch (DebuggerException e) {
					fullname = e.Message;
				}
				info.AddChild("ExactType", fullname);
				items.Add(info);
			}
			if (corValue is ICorDebugGenericValue) {
				InfoNode info = new InfoNode("ICorDebugGenericValue", "");
				try {
					byte[] bytes = ((ICorDebugGenericValue)corValue).GetRawValue();
					for(int i = 0; i < bytes.Length; i += 8) {
						string val = "";
						for(int j = i; j < bytes.Length && j < i + 8; j++) {
							val += bytes[j].ToString("X2") + " ";
						}
						info.AddChild("Value" + i.ToString("X2"), val);
					}
				} catch (System.ArgumentException) {
					info.AddChild("Value", "N/A");
				}
				items.Add(info);
			}
			if (corValue is ICorDebugReferenceValue) {
				InfoNode info = new InfoNode("ICorDebugReferenceValue", "");
				ICorDebugReferenceValue refValue = (ICorDebugReferenceValue)corValue;
				info.AddChild("IsNull", (refValue.IsNull() != 0).ToString());
				if (refValue.IsNull() == 0) {
					info.AddChild("Value", refValue.GetValue().ToString("X8"));
					if (refValue.Dereference() != null) {
						info.AddChild("Dereference", "", GetDebugInfo(appDomain, refValue.Dereference()));
					} else {
						info.AddChild("Dereference", "N/A");
					}
				}
				items.Add(info);
			}
			if (corValue is ICorDebugHeapValue) {
				InfoNode info = new InfoNode("ICorDebugHeapValue", "");
				items.Add(info);
			}
			if (corValue is ICorDebugHeapValue2) {
				InfoNode info = new InfoNode("ICorDebugHeapValue2", "");
				items.Add(info);
			}
			if (corValue is ICorDebugObjectValue) {
				InfoNode info = new InfoNode("ICorDebugObjectValue", "");
				ICorDebugObjectValue objValue = (ICorDebugObjectValue)corValue;
				info.AddChild("Class", objValue.GetClass().GetToken().ToString("X8"));
				info.AddChild("IsValueClass", (objValue.IsValueClass() != 0).ToString());
				items.Add(info);
			}
			if (corValue is ICorDebugObjectValue2) {
				InfoNode info = new InfoNode("ICorDebugObjectValue2", "");
				items.Add(info);
			}
			if (corValue is ICorDebugBoxValue) {
				InfoNode info = new InfoNode("ICorDebugBoxValue", "");
				ICorDebugBoxValue boxValue = (ICorDebugBoxValue)corValue;
				info.AddChild("Object", "", GetDebugInfo(appDomain, boxValue.GetObject()));
				items.Add(info);
			}
			if (corValue is ICorDebugStringValue) {
				InfoNode info = new InfoNode("ICorDebugStringValue", "");
				ICorDebugStringValue stringValue = (ICorDebugStringValue)corValue;
				info.AddChild("Length", stringValue.GetLength().ToString());
				info.AddChild("String", stringValue.GetString());
				items.Add(info);
			}
			if (corValue is ICorDebugArrayValue) {
				InfoNode info = new InfoNode("ICorDebugArrayValue", "");
				info.AddChild("...", "...");
				items.Add(info);
			}
			if (corValue is ICorDebugHandleValue) {
				InfoNode info = new InfoNode("ICorDebugHandleValue", "");
				ICorDebugHandleValue handleValue = (ICorDebugHandleValue)corValue;
				info.AddChild("HandleType", handleValue.GetHandleType().ToString());
				items.Add(info);
			}
			
			return items;
		}