コード例 #1
0
        public GuideFlashTask(int task, GuideTaskType type, GameObject mParent)
            : base(task, type, mParent)
        {
            //读取数据
            flashTask = ConfigReader.GetFlashTaskInfo(task);
            if (flashTask == null)
            {
                Debug.LogError("GuideFlashTask 任务id不存在" + task);
            }
            Transform btnParent = null;

            switch (flashTask.PathType)
            {
            case UIPathType.UIGuideType:
                if (UINewsGuide.Instance != null)
                {
                    btnParent = UINewsGuide.Instance.transform;
                }
                break;

            case UIPathType.UIPlayType:
//                     if (UIPlay.Instance != null)
//                     {
//                         btnParent = UIPlay.Instance.transform;
//                     }
                break;
            }
            if (btnParent == null)
            {
                Debug.LogError("GuideFlashTask = " + task + "挂点不存在");
            }
            if (!string.IsNullOrEmpty(flashTask.UiPath))
            {
                objFlash = btnParent.Find(flashTask.UiPath).gameObject;
            }
            else
            {
                //objFlash = GameObject.Instantiate(Resources.Load(flashTask.PrefabPath)) as GameObject;
                ResourceItem objFlashUnit = ResourcesManager.Instance.loadImmediate(flashTask.PrefabPath, ResourceType.PREFAB);
                objFlash = GameObject.Instantiate(objFlashUnit.Asset) as GameObject;
            }
            if (string.IsNullOrEmpty(flashTask.UiPath))
            {
                objFlash.transform.parent = btnParent;
            }
            objFlash.transform.localPosition = flashTask.StartPos;
            objFlash.transform.localScale    = Vector3.one;
            orignalActive = objFlash.activeInHierarchy;
            orignalPos    = objFlash.transform.localPosition;
            objFlash.gameObject.SetActive(true);
        }
コード例 #2
0
 public override void ClearTask()
 {
     base.ClearTask();
     if (!string.IsNullOrEmpty(flashTask.UiPath))
     {
         if (flashTask.OverReset == 1)
         {
             objFlash.SetActive(orignalActive);
             objFlash.transform.localPosition = orignalPos;
         }
     }
     else
     {
         if (objFlash != null)
         {
             GameObject.DestroyObject(objFlash);
         }
     }
     tween     = null;
     flashTask = null;
     objFlash  = null;
 }