예제 #1
0
    /// <summary>
    /// 创建血条
    /// </summary>
    /// <param name="tagert">血条模板 Prefab </param>
    /// <param name="parent">父节点</param>
    /// <returns></returns>
    public static LYXHeroBlood CreateBlood(GameObject tagert, Transform parent)
    {
        GameObject bgo = GameObject.Instantiate(tagert) as GameObject;

        if (bgo == null)
        {
            return(null);
        }
        Transform btrans = bgo.transform;

        if (parent != null)
        {
            btrans.parent = parent;
        }
        btrans.localPosition = Vector3.zero;
        btrans.localRotation = Quaternion.identity;
        btrans.localScale    = Vector3.one;
        LYXHeroBlood blood = LCSCompHelper.FindComponet <LYXHeroBlood>(bgo);

        // 血条
        blood.bloodSlider = btrans.Find("blood/bloodslider").GetComponent <UISlider>();
        //怒气
        blood.angSlider  = btrans.Find("anger/angerslider").GetComponent <UISlider>();
        blood.mBloodTime = 0;
        blood.mIsRefresh = false;
        blood.gameObject.SetActive(false);
        return(blood);
    }
예제 #2
0
    /// <summary>
    /// 创建战斗角色模型
    /// </summary>
    private void CreateBattleModel()
    {
        _heroObject = new List <LYXHeroObject>();

        for (int i = 0, len = _heroEntityList.Count; i < len; i++)
        {
            LYXHeroEntity own       = _heroEntityList[i];
            LYXHeroObject ownObject = LCSCompHelper.LoadResource <LYXHeroObject>("RoleModel/" + own.HeroModel);
            if (ownObject == null)
            {
                continue;
            }
            ownObject.mHeroEnity  = own;
            ownObject.mMoveEndPos = mEndMovePos;
            string parPath = own.FriendAndFoe == 1 ? "own" : "enemy";
            InitHeroObjectPosition(ownObject.transform, parPath + "/" + own.HeroPos);
            if (own.FriendAndFoe == 1)
            {
                ownObject.transform.localScale = new Vector3(-1, 1, 1);
            }
            ownObject.mBatManage = this;
            _heroObject.Add(ownObject);
        }

        _isIntoBattle = true;
    }
예제 #3
0
        /// <summary>
        ///  创建界面
        /// </summary>
        /// <param name="winPath">加载资源路径</param>
        /// <param name="winName">打开界面的名字</param>
        private static LAUIBehaviour CreatePage(string winName, string winPath)
        {
            if (string.IsNullOrEmpty(winName))
            {
                LCSConsole.WriteError("打开的界面名字为空! pageName = " + winName);
                return(null);
            }
            if (string.IsNullOrEmpty(winPath))
            {
                LCSConsole.WriteError("加载资源 AssetBundle 文件路径为空! bundlePath = " + winPath);
                return(null);
            }
            GameObject ui = LCSManageSource.LoadSource(winName, winPath);

            if (ui == null)
            {
                LCSConsole.WriteError("加载的资源不存在!");
                return(null);
            }
            GameObject go = GameObject.Instantiate(ui) as GameObject;

            if (go == null)
            {
                return(null);
            }
            LCSCompHelper.InitTransform(go, UIRoot);
            return(LCSCompHelper.GetComponent <LAUIBehaviour>(go));
        }
예제 #4
0
        /// <summary>
        /// 增加一个销毁脚本
        ///
        /// 开启一个销毁
        /// </summary>
        /// <returns></returns>
        public static LCSelfDestroy Begin(GameObject go, float dtyTime)
        {
            LCSelfDestroy dest = LCSCompHelper.FindComponet <LCSelfDestroy>(go);

            dest.mDtyTime = dtyTime;
            return(dest);
        }
예제 #5
0
        /// <summary>
        /// 异步打开界面回调
        /// </summary>
        private static void AsyncOpenWindowCallback(string winName, GameObject go)
        {
            if (string.IsNullOrEmpty(winName))
            {
                LCSConsole.WriteError("打开的界面名字为空! winName = string.Empty");
                return;
            }

            if (go == null)
            {
                LCSConsole.WriteError("资源加载失败!");
                return;
            }

            GameObject ui = GameObject.Instantiate(go) as GameObject;

            if (ui == null)
            {
                return;
            }
            LCSCompHelper.InitTransform(go, UIRoot);
            LAUIBehaviour win = LCSCompHelper.GetComponent <LAUIBehaviour>(ui);

            int           depth  = 1;
            LAUIBehaviour topWin = TopWindow();

            if (topWin != null)
            {
                depth = topWin.WinDepth + LCSConfig.DepthSpan;
            }

            // 初始化当前界面
            win.OnOpen(depth, winName);
            Add <LCSUIManage>(winName, win);
        }
예제 #6
0
 /// <summary>
 /// 界面失去焦点
 /// </summary>
 public virtual void OnLostFocus()
 {
     if (mBoxColliders == null)
     {
         return;
     }
     LCSCompHelper.CollidersEnabled(mBoxColliders, false);
 }
예제 #7
0
    /// <summary>
    /// 创建特效
    /// </summary>
    /// <param name="effName"> 所以特效都放到 Effects 下, 特效的名字</param>
    /// <param name="parent">特效的父节点</param>
    /// <returns></returns>
    public static LYXSkillEffects CreateEffects(string effName, Transform parent)
    {
        LYXSkillEffects effects = LCSCompHelper.LoadAndInstance <LYXSkillEffects>("Effects/" + effName, parent);

        if (effects == null)
        {
            return(null);
        }
        return(effects);
    }
예제 #8
0
 /// <summary>
 /// 初始化侠客的位置
 /// </summary>
 /// <param name="current">侠客</param>
 /// <param name="parentPath">侠客父节点路径</param>
 public void InitHeroObjectPosition(Transform current, string parentPath)
 {
     if (!string.IsNullOrEmpty(parentPath))
     {
         current.parent = LCSCompHelper.FindTransform(mBattleFormation, parentPath);
     }
     current.localPosition = Vector3.zero;
     current.localRotation = Quaternion.identity;
     current.localScale    = Vector3.one;
 }
예제 #9
0
 public override void Update()
 {
     if (anchorUpdate == LYXAnchorUpdate.OnUpdate)
     {
         Vector2 vect = LCSCompHelper.SceneWidthAndHeight();
         mSceneWidth  = (int)vect.x;
         mSceneHeight = (int)vect.y;
         AdaptiveScene();
     }
 }
예제 #10
0
        /// <summary>
        /// 开始堆栈
        /// </summary>
        /// <returns></returns>
        public static LCLogStack Begin()
        {
            // todo: 增加启动 项目开始时设置
            if (_instance != null)
            {
                return(_instance);
            }
            GameObject create = LCSCompHelper.Create("_LOG Stack");

            _instance = LCSCompHelper.FindComponet <LCLogStack>(create);
            Application.RegisterLogCallback(_instance.LogCallback);
            return(_instance);
        }
예제 #11
0
    /// <summary>
    /// 设置血条的位置
    /// </summary>
    /// <param name="target">血条目标点</param>
    /// <param name="offect">偏移</param>
    public void SetBloodPostion(GameObject target, Vector3 offect)
    {
        if (target == null)
        {
            return;
        }
        LCUIInset3D uiInset = LCSCompHelper.FindComponet <LCUIInset3D>(gameObject);

        if (uiInset == null)
        {
            return;
        }
        uiInset.mOffset = offect;
        uiInset.mTarget = target;
    }
예제 #12
0
        public static LCDelayAction BeginAction(GameObject go, float delayTime, Action action)
        {
            if (go == null && action == null)
            {
                return(null);
            }
            if (go == null || delayTime <= 0)
            {
                action();
                return(null);
            }
            LCDelayAction delact = LCSCompHelper.FindComponet <LCDelayAction>(go);

            delact.mActionBack = action;
            delact.mActionTime = delayTime;
            return(delact);
        }
예제 #13
0
    /// <summary>
    /// 初始化ui 界面
    /// </summary>
    public void InitUIPanel(LYXBattleManage mage, LYXHeroEntity entity)
    {
        _manage         = mage;
        _heroEntity     = entity;
        _isStartRefresh = true;

        // 血条
        bloodSlider = LCSCompHelper.FindComponet <UISlider>(gameObject, "roleblood/blood/bloodslider");
        //怒气
        angSlider  = LCSCompHelper.FindComponet <UISlider>(gameObject, "roleblood/anger/angerslider");
        heroDieSpr = LCSCompHelper.FindComponet <UISprite>(gameObject, "die");

        heroDieSpr.gameObject.SetActive(false);
        mTweenRota         = TweenRotation.Begin(gameObject, 0.1f, Quaternion.identity);
        mTweenRota.enabled = false;
        isHasTween         = false;
    }
예제 #14
0
    /// <summary>
    /// 创建伤害值
    /// </summary>
    /// <param name="parent">父节点</param>
    /// <param name="target">伤害值位置</param>
    /// <param name="hurtValue">伤害值</param>
    /// <param name="offect">便宜位置</param>
    /// <returns></returns>
    public static LYXBattleBuffer CreateHarm(GameObject parent, GameObject target, float hurtValue, Vector3 offect)
    {
        LYXBattleBuffer buffer = LCSCompHelper.LoadResource <LYXBattleBuffer>("Prefab/hurtvalue");
        UILabel         lab    = buffer.GetComponent <UILabel>();

        if (lab == null)
        {
            return(null);
        }
        lab.text = "[ff0000] -" + hurtValue;
        Transform trans = lab.transform;

        trans.parent        = parent.transform;
        trans.localPosition = Vector3.zero;
        trans.localRotation = Quaternion.identity;
        trans.localScale    = Vector3.one;
        trans.position      = target.transform.position;
        trans.localPosition = trans.localPosition + offect;
        return(buffer);
    }
예제 #15
0
        public override void Awake()
        {
            transform.localScale = Vector3.one;
            anchorWidget         = gameObject.GetComponent <UIWidget>();
            bool    isWidget = anchorWidget != null;
            Vector2 vect     = LCSCompHelper.SceneWidthAndHeight();

            mSceneWidth  = (int)vect.x;
            mSceneHeight = (int)vect.y;
            if (isWidget)
            {
                anchorWidget.ResetAnchors();
                mOriginalWidth  = anchorWidget.localSize.x;
                mOriginalHeight = anchorWidget.localSize.y;
            }
            else
            {
                // 1024 - 15
                // 768 - 11
                mOriginalWidth  = 15 / 1024f;
                mOriginalHeight = 11 / 768f;
            }
        }
예제 #16
0
 /// <summary>
 /// 开始分析
 /// </summary>
 /// <returns></returns>
 public static LCProfiler BeginProfiler(GameObject go)
 {
     return(go == null ? null : LCSCompHelper.FindComponet <LCProfiler>(go));
 }
예제 #17
0
 public virtual new void Awake()
 {
     mPanels       = LCSCompHelper.GetComponents <UIPanel>(gameObject);
     mBoxColliders = LCSCompHelper.GetComponents <Collider>(gameObject);
 }
예제 #18
0
        /// <summary>
        /// 开始分析
        ///
        /// 自己创建一个节点
        /// </summary>
        /// <returns></returns>
        public static LCProfiler BeginProfiler()
        {
            GameObject create = LCSCompHelper.Create("_Profiler");

            return(BeginProfiler(create));
        }