public TransNode InsertNode(int index, bool needRefreshGfxData)
        {
            if (this.nodeLst == null)
            {
                this.nodeLst = new ListView <TransNode>();
            }
            if (index < 0)
            {
                return(null);
            }
            TransNode transNode = new TransNode();

            if (index >= this.nodeLst.Count)
            {
                if (this.nodeLst.Count > 0)
                {
                    TransNode transNode2 = this.nodeLst[this.nodeLst.Count - 1];
                    transNode.pos     = transNode2.pos;
                    transNode.isCubic = transNode2.isCubic;
                }
                this.nodeLst.Add(transNode);
            }
            else
            {
                TransNode transNode3 = this.nodeLst[index];
                transNode.pos     = transNode3.pos;
                transNode.isCubic = transNode3.isCubic;
                this.nodeLst.Insert(index, transNode);
            }
            if (needRefreshGfxData)
            {
                this.RefreshDataToGfx();
            }
            return(transNode);
        }
Esempio n. 2
0
 public void UnifyCubicPropertyToAllNodes(bool cubic)
 {
     this.isCubic = cubic;
     using (ListView <TransNode> .Enumerator enumerator = this.nodeLst.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             TransNode current = enumerator.get_Current();
             current.isCubic = cubic;
         }
     }
 }
        public TransNode AddNode(bool needRefreshGfxData)
        {
            if (this.nodeLst == null)
            {
                this.nodeLst = new ListView <TransNode>();
            }
            TransNode transNode = new TransNode();

            this.nodeLst.Add(transNode);
            if (needRefreshGfxData)
            {
                this.RefreshDataToGfx();
            }
            return(transNode);
        }
Esempio n. 4
0
 private void SyncTransformDataToTransNode()
 {
     if ((this.nodeLst != null) && (this.nodeLst.Count != 0))
     {
         if (((this.transNodeObjs == null) || (this.transNodeObjs.Count < this.nodeLst.Count)) || (this.transNodeObjs[0] == null))
         {
             this.RefreshDataToGfx();
         }
         if (this.transNodeObjs != null)
         {
             for (int i = 0; i < this.nodeLst.Count; i++)
             {
                 TransNode node      = this.nodeLst[i];
                 Transform transform = this.transNodeObjs[i].transform;
                 node.pos = transform.position;
                 node.rot = transform.rotation;
                 node.scl = transform.localScale;
             }
         }
     }
 }
 private void SyncTransformDataToTransNode()
 {
     if (this.nodeLst == null || this.nodeLst.Count == 0)
     {
         return;
     }
     if (this.transNodeObjs == null || this.transNodeObjs.Count < this.nodeLst.Count || this.transNodeObjs[0] == null)
     {
         this.RefreshDataToGfx();
     }
     if (this.transNodeObjs != null)
     {
         for (int i = 0; i < this.nodeLst.Count; i++)
         {
             TransNode transNode = this.nodeLst[i];
             Transform transform = this.transNodeObjs[i].transform;
             transNode.pos = transform.position;
             transNode.rot = transform.rotation;
             transNode.scl = transform.localScale;
         }
     }
 }
Esempio n. 6
0
 private void SyncTransformDataToTransNode()
 {
     if (this.nodeLst == null || this.nodeLst.get_Count() == 0)
     {
         return;
     }
     if (this.transNodeObjs == null || this.transNodeObjs.get_Count() < this.nodeLst.get_Count() || this.transNodeObjs.get_Item(0) == null)
     {
         this.RefreshDataToGfx();
     }
     if (this.transNodeObjs != null)
     {
         for (int i = 0; i < this.nodeLst.get_Count(); i++)
         {
             TransNode transNode = this.nodeLst.get_Item(i);
             Transform transform = this.transNodeObjs.get_Item(i).transform;
             transNode.pos = transform.position;
             transNode.rot = transform.rotation;
             transNode.scl = transform.localScale;
         }
     }
 }
        public void RefreshDataToGfx()
        {
            this.InitData();
            int count = this.transNodeObjs.Count;
            int i;

            for (i = 0; i < this.nodeLst.Count; i++)
            {
                TransNode  transNode  = this.nodeLst[i];
                GameObject gameObject = null;
                string     name       = "CurvlTransNode_" + i;
                if (i >= count)
                {
                    GameObject gameObject2 = this.curvlRootObj;
                    if (gameObject2 != null)
                    {
                        for (int j = 0; j < gameObject2.transform.childCount; j++)
                        {
                            gameObject = gameObject2.transform.GetChild(j).gameObject;
                            string   name2 = gameObject.name;
                            string[] array = name2.Split(new char[]
                            {
                                '_'
                            });
                            int num = -1;
                            int.TryParse(array[1], ref num);
                            if (num == i)
                            {
                                break;
                            }
                            gameObject = null;
                        }
                    }
                    if (gameObject == null)
                    {
                        gameObject                  = (ActionManager.InstantiateObject(this.transObjPrefb) as GameObject);
                        gameObject.name             = name;
                        gameObject.transform.parent = this.curvlRootObj.transform;
                        Camera camera = gameObject.GetComponent <Camera>();
                        if (camera == null && this.useCamera)
                        {
                            camera = gameObject.AddComponent <Camera>();
                        }
                        else if (camera != null && !this.useCamera)
                        {
                            Object.DestroyImmediate(camera);
                        }
                    }
                    this.transNodeObjs.Add(gameObject);
                }
                else
                {
                    gameObject = this.transNodeObjs[i];
                    if (gameObject == null)
                    {
                        gameObject                  = (ActionManager.InstantiateObject(this.transObjPrefb) as GameObject);
                        gameObject.name             = name;
                        gameObject.transform.parent = this.curvlRootObj.transform;
                        Camera camera2 = gameObject.GetComponent <Camera>();
                        if (camera2 == null && this.useCamera)
                        {
                            camera2 = gameObject.AddComponent <Camera>();
                        }
                        else if (camera2 != null && !this.useCamera)
                        {
                            Object.DestroyImmediate(camera2);
                        }
                        this.transNodeObjs[i] = gameObject;
                    }
                }
                Transform transform = gameObject.transform;
                gameObject.SetActive(true);
                transform.position = transNode.pos;
                transform.rotation = transNode.rot;
            }
            for (int k = i; k < count; k++)
            {
                this.transNodeObjs[k].SetActive(false);
            }
        }
Esempio n. 8
0
        public void RefreshDataToGfx()
        {
            this.InitData();
            int count = this.transNodeObjs.Count;
            int num2  = 0;

            while (num2 < this.nodeLst.Count)
            {
                TransNode  node = this.nodeLst[num2];
                GameObject item = null;
                string     str  = "CurvlTransNode_" + num2;
                if (num2 >= count)
                {
                    GameObject curvlRootObj = this.curvlRootObj;
                    if (curvlRootObj != null)
                    {
                        for (int j = 0; j < curvlRootObj.transform.childCount; j++)
                        {
                            item = curvlRootObj.transform.GetChild(j).gameObject;
                            char[]   separator = new char[] { '_' };
                            string[] strArray  = item.name.Split(separator);
                            int      result    = -1;
                            int.TryParse(strArray[1], out result);
                            if (result == num2)
                            {
                                break;
                            }
                            item = null;
                        }
                    }
                    if (item == null)
                    {
                        item                  = ActionManager.InstantiateObject(this.transObjPrefb) as GameObject;
                        item.name             = str;
                        item.transform.parent = this.curvlRootObj.transform;
                        Camera component = item.GetComponent <Camera>();
                        if ((component == null) && this.useCamera)
                        {
                            component = item.AddComponent <Camera>();
                        }
                        else if ((component != null) && !this.useCamera)
                        {
                            UnityEngine.Object.DestroyImmediate(component);
                        }
                    }
                    this.transNodeObjs.Add(item);
                }
                else
                {
                    item = this.transNodeObjs[num2];
                    if (item == null)
                    {
                        item                  = ActionManager.InstantiateObject(this.transObjPrefb) as GameObject;
                        item.name             = str;
                        item.transform.parent = this.curvlRootObj.transform;
                        Camera camera2 = item.GetComponent <Camera>();
                        if ((camera2 == null) && this.useCamera)
                        {
                            camera2 = item.AddComponent <Camera>();
                        }
                        else if ((camera2 != null) && !this.useCamera)
                        {
                            UnityEngine.Object.DestroyImmediate(camera2);
                        }
                        this.transNodeObjs[num2] = item;
                    }
                }
                Transform transform = item.transform;
                item.SetActive(true);
                transform.position = node.pos;
                transform.rotation = node.rot;
                num2++;
            }
            for (int i = num2; i < count; i++)
            {
                this.transNodeObjs[i].SetActive(false);
            }
        }