public override void StartAction(GameObject model, Transform world)
 {
     TreeWrap.Init();
     FxFileUtils.GetFireSetting = GetFireSetting;
     FileTools.Start();
     base.StartAction(model, world);
 }
 public void Play(TreeCanvas canvas)
 {
     if (_controller == null)
     {
         _prevPosition = hero.transform.position;
         FireFxRoot r = new FireFxRoot();
         TreeWrap.Init();
         TreeEditorFactory.Start();
         new TreeToRuntimeComp(canvas, TreeFactory.CreateInstance, r).Transfer();
         _controller = new EtFireFxContoller(hero, r)
         {
             targetPos = hero.transform.position
         };
         FireFxInfo[] infos = new FireFxInfo[targets.Length];
         for (int i = 0; i < targets.Length; i++)
         {
             FireFxInfo info = new FireFxInfo(new FireEnemy(targets[i]));
             if (i == 0)
             {
                 _controller.mainTargetInfo = info;
                 _controller.targetPos      = info.position;
                 _controller.endHostPos     = info.position;
             }
             infos[i] = info;
         }
         _controller.targetInfos = infos;
         _controller.completeEvent.AddListener(OnComplete);
         GameTicker.tickerManager.Add(_controller);
         _controller.Start();
     }
     else
     {
         Debug.Log("the current firefx control is running");
     }
 }
        private static FireFxRoot GetFireSetting(Object t)
        {
            TreeWrap.Init();
            string     path       = AssetDatabase.GetAssetPath(t);
            XDocument  doc        = XDocument.Load(path);
            XElement   root       = doc.Root;
            string     canvasType = StringDataTools.XAttribute(root, "type");
            TreeCanvas canvas     = TreeEditorFactory.GetCanvas(canvasType);

            canvas.Read(root);
            FireFxRoot r = new FireFxRoot();

            new TreeToRuntimeComp(canvas, TreeFactory.CreateInstance, r).Transfer();
            return(r);
        }
        internal void OnEnable()
        {
            if (!followCamera)
            {
                Debug.LogError("no camera found");
                return;
            }
            FileTools.Start();
            //LuaManager.Init();
            //new Lua_Starter(() => { Debug.Log("lua init complete"); }).Start();
            GameObject o = GameObject.Find("HudCanvas");

            if (o)
            {
                HudManager.panel = o.GetComponent <RectTransform>();
            }
            _hostEntity = new TestHost(gameObject, speed);
            _hostEntity.Initialize();
            MachineWrap.Init();
            TreeWrap.Init();
            string stream = FileTools.wwwStreamingAssetsPath;

            if (string.IsNullOrEmpty(stream))
            {
                return;
            }
            CpxRetriever r = new CpxRetriever {
                actionRetriever    = CpxMachineFactory.GetAction,
                stateRetriever     = CpxMachineFactory.GetState,
                conditionRetriever = CpxMachineFactory.GetCondition
            };

            MachineFactory.Start();
            MachineChart  m    = MachineFileManager.Load(AssetDatabase.GetAssetPath(machineFile));
            CpxController ctrl = new ChartToMachine().Transfer(m, r);

            _hostEntity.runtimeController.Inititalize(ctrl);
            TreeEditorFactory.Start();
            _fireSettings = new FireFxRoot[_fxAssets.Length];
            for (int i = 0, len = _fireSettings.Length; i < len; i++)
            {
                _fireSettings[i] = GetFireSetting(_fxAssets[i]);
            }
        }
 public static MvcHtmlString Tree(this HtmlHelper hh, TreeWrap<CodeNote.Entity.Category> tree)
 {
     TagBuilder div = new TagBuilder("div");
     div.MergeAttribute("class", "tree");
     div.InnerHtml = InitTree(hh, tree);
     return MvcHtmlString.Create(div.ToString());
 }
 public static string InitTree(HtmlHelper hh, TreeWrap<CodeNote.Entity.Category> tree)
 {
     if (tree.IsSub)
     {
         TagBuilder ul = new TagBuilder("ul");
         StringBuilder sb = new StringBuilder();
         foreach (TreeWrap<CodeNote.Entity.Category> item in tree.SubNode)
         {
             TagBuilder li = new TagBuilder("li");
             TagBuilder label = new TagBuilder("label");
             string hid = string.Format("<input type=\"checkbox\" name=\"chkCategory\" value=\"{0}\" onchange=\"ChkCategoryChange(this)\" />", item.CurNode.CategoryID);
             label.MergeAttribute("title", item.CurNode.Title);
             label.InnerHtml = hid + "&nbsp;" + item.CurNode.Name + "(" + item.CurNode.Title + ")";
             li.InnerHtml = label.ToString() + InitTree(hh, item);
             sb.Append(li.ToString());
         }
         ul.InnerHtml = sb.ToString();
         return ul.ToString();
     }
     return string.Empty;
 }
Beispiel #7
0
 private TreeWrap<Category> InitTree(TreeWrap<Category> root)
 {
     IList<Category> list = this.GetByParentID(root.CurNode.CategoryID);
     foreach (Category item in list)
     {
         TreeWrap<Category> subItem = new TreeWrap<Category>(item);
         InitTree(subItem);
         root.AddSubNode(subItem);
     }
     return root;
 }
Beispiel #8
0
 /// <summary>
 /// 获取分类的树状列表
 /// </summary>
 /// <returns></returns>
 public TreeWrap<Category> GetCategoryTree()
 {
     TreeWrap<Category> tree = new TreeWrap<Category>();
     tree.CurNode = new Category() { CategoryID = "0", Name = "分类信息" };
     return InitTree(tree);
 }