protected AbstractSpriteObj(string path, Vector3 pos, Transform parent = null)
 {
     obj = MemoryMgr.Instantiate(path, pos, Quaternion.identity, parent);
     if (obj == null)
     {
         throw new Exception("子弹生成失败");
     }
     MainLoop.Instance.AddUpdateFunc(Update);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 创建窗体
        /// </summary>
        /// <returns></returns>
        protected void Create(string path)
        {
            m_sResName = path;

            if (m_TransFrom)
            {
                Debug.LogError("Window Create Error Exist");
                return;
            }

            if (string.IsNullOrEmpty(m_sResName))
            {
                Debug.LogError("Windows Create Error ResName is empty");
                return;
            }


            var canvas = Global.GlobalVar.G_Canvas.transform;

            if (null == canvas)
            {
                Debug.Log("画布获取失败");
            }

            var obj = MemoryMgr.Instantiate(m_sResName, canvas);

            if (obj == null)
            {
                Debug.LogError("Window Create Error LoadRes WindowName = " + m_sResName);
                return;
            }

            m_TransFrom = obj.transform;

            m_TransFrom.gameObject.SetActive(false);

            InitWindow();
        }