Esempio n. 1
0
        /// <summary>
        /// 获得转换后的属性字符窜,比如百分比,KGM
        /// </summary>
        /// <returns></returns>
        public static string GetAttrNumber(T Type, float Val)
        {
            List <TDAttrData> tempAttrData = GetAttrDataList();

            if (tempAttrData != null)
            {
                var tempData = tempAttrData[BoxAvoidance <T> .ToInt(Type)];
                if (tempData.NumberType == NumberType.KMG)
                {
                    return(BaseUIUtils.KMG(Val));
                }
                else if (tempData.NumberType == NumberType.Percent)
                {
                    return(BaseUIUtils.Percent(Val));
                }
                else if (tempData.NumberType == NumberType.Normal)
                {
                    return(BaseUIUtils.OptionalTwoDigit(Val));
                }
                else if (tempData.NumberType == NumberType.Integer)
                {
                    return(BaseUIUtils.Round(Val));
                }
                else if (tempData.NumberType == NumberType.Bool)
                {
                    return(BaseUIUtils.Bool(Val));
                }
            }
            return(Val.ToString());
        }
Esempio n. 2
0
 public override void OnUpdate()
 {
     base.OnUpdate();
     if (RTSCamera == null || CameraHight == float.NaN)
     {
         return;
     }
     if (BattleMgr.IsInBattle)
     {
         var   data         = SettingsData;
         float speedFaction = 1;
         if (IsLowHight)
         {
             speedFaction = 0.9f;
         }
         else if (IsNearHight)
         {
             speedFaction = 0.8f;
         }
         RTSCamera.DesktopMoveDragSpeed = (ZoomPercent * RTSCamera.desktopMoveDragSpeed) * data.CameraMoveSpeed * speedFaction;
         RTSCamera.DesktopMoveSpeed     = (ZoomPercent * RTSCamera.desktopMoveSpeed) * data.CameraMoveSpeed * speedFaction;
         RTSCamera.DesktopScrollSpeed   = (RTSCamera.desktopScrollSpeed) * data.CameraScrollSpeed;
         if (Input.GetMouseButtonDown(2))
         {
             Vector3 pos = SelfBaseGlobal.ScreenMgr.GetMouseHitPoint();
             RTSCamera.JumpToTargetForMain(SelfBaseGlobal.GetTransform(pos));
         }
         bool isOnUI = BaseUIUtils.CheckGuiObjects();
         RTSCamera.MouseScrollControl(!isOnUI);
         RTSCamera.MouseDragControl(!isOnUI);
         RTSCamera.ControlDisabled.Set(BaseView.IsFullScreenState.IsIn());
     }
 }
Esempio n. 3
0
 protected string SetDesc(string str = "", params object[] obs)
 {
     str = BaseLanguageMgr.Get(str, obs);
     return(BaseUIUtils.Condition(GetRet(), str));
     //if (GetRet())
     //    return BaseConstansMgr.STR_Indent + "<Color=green>" + str + "</Color>";
     //return BaseConstansMgr.STR_Indent + "<Color=red>" + str + "</Color>";
 }
Esempio n. 4
0
 public void JumpDamage(float val, bool needPlayer = false)
 {
     if (!IsCanJump(needPlayer))
     {
         return;
     }
     addToJumpFontList(BaseUIUtils.RoundDigit(val), DamageText);
 }
Esempio n. 5
0
        public string GetDesc()
        {
            string str = BaseLanguageMgr.Get(key, objs);

            return(BaseUIUtils.Condition(isTrue, str));
            //if (isTrue)
            //    return BaseConstansMgr.STR_Indent + "<Color=green>" + str + "</Color>";
            //return BaseConstansMgr.STR_Indent + "<Color=red>" + str + "</Color>";
        }
Esempio n. 6
0
 public string ToJumpCostStr(bool isReserve)
 {
     if (isReserve)
     {
         return("+" + (Type as Enum).GetName() + BaseUIUtils.OptionalTwoDigit(RealVal));
     }
     else
     {
         return("-" + (Type as Enum).GetName() + BaseUIUtils.OptionalTwoDigit(RealVal));
     }
 }
Esempio n. 7
0
 protected virtual void OnTouchUp(Vector3 mousePosition, int i)
 {
     if (i == 1)
     {
     }
     else if (i == 0)
     {
         if (!BaseUIUtils.CheckGuiObjects() && LastHitCollider == null && IsSameMousePtClick())
         {
             SelectUnit(null);
         }
     }
 }
Esempio n. 8
0
        /// <summary>
        /// 获取带有颜色的加成字符,附带正面效果和负面效果的颜色变化
        /// </summary>
        /// <param name="Type"></param>
        /// <param name="Val"></param>
        /// <returns></returns>
        public static string GetAttrStr(T Type, float Val, bool?isPercent = null, bool isIgnoreName = false, bool isColor = true)
        {
            List <TDAttrData> tempAttrData = GetAttrDataList();
            var    tempData    = tempAttrData[BoxAvoidance <T> .ToInt(Type)];
            string color       = GetAttrColor(Type, Val);
            bool   tempPercent = false;
            bool   tempBool    = false;

            //设置输入的百分比
            if (isPercent.HasValue)
            {
                tempPercent = isPercent.Value;
            }
            //如果是百分比数值则直接使用百分比
            if (tempData.NumberType == NumberType.Percent)
            {
                tempPercent = true;
            }
            if (tempData.NumberType == NumberType.Bool)
            {
                tempBool = true;
            }

            //属性名称
            string name = isIgnoreName ? "" : (Type as Enum).GetName();
            //设置属性值
            string strVal = "No";

            if (tempBool)
            {
                strVal = BaseUIUtils.Bool(Val);
            }
            else if (tempPercent)
            {
                strVal = BaseUIUtils.PercentSign(Val);
            }
            else
            {
                strVal = BaseUIUtils.Sign((float)Math.Round(Val, 2));
            }
            //组合
            string str1 = name + strVal;

            //属性颜色
            if (isColor)
            {
                str1 = color + str1 + "</color>";
            }
            return(str1);
        }
        void DrawAttr()
        {
            if (Attr == null)
            {
                return;
            }
            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical();
            BasePreviewUtile.Header("属性:");
            foreach (var item in Attr)
            {
                EditorGUILayout.LabelField(item.Key + ":" + BaseUIUtils.OptionalTwoDigit(item.Value));
            }

            if (GUILayout.Button("刷新"))
            {
                RefreshAttr();
            }

            EditorGUILayout.EndVertical();
        }
Esempio n. 10
0
        protected virtual void OnTouchDown(Vector3 mousePosition, int i)
        {
            LastMouseDownPos = Input.mousePosition;
            RaycastHit hit;

            MouseRayCast(out hit, SelectUnitLayerMask);
            {
                if (BaseUIUtils.CheckGuiObjects())
                {
                    return;
                }
                LastHitCollider = hit.collider;
                if (i == 1)//右键
                {
                    if (LastHitCollider != null)
                    {
                        BaseUnit tempUnit = LastHitCollider.GetComponent <BaseUnit>();
                        if (tempUnit != null)
                        {
                            RightClickUnit(tempUnit);
                        }
                    }
                }
                else if (i == 0)//左键
                {
                    if (LastHitCollider != null)
                    {
                        BaseUnit tempUnit = LastHitCollider.GetComponent <BaseUnit>();
                        if (tempUnit != null)
                        {
                            SelectUnit(tempUnit);
                            LeftClickUnit(tempUnit);
                        }
                    }
                }
            }
        }
Esempio n. 11
0
        /// <summary>
        /// 获得完整的属性字符窜
        /// </summary>
        /// <param name="Type"></param>
        /// <param name="RealVal"></param>
        /// <param name="isHaveSign"></param>
        /// <param name="isHaveColor"></param>
        /// <param name="isHeveAttrName"></param>
        /// <returns></returns>
        public static string GetFullAttrString(T Type, float RealVal, bool isHaveSign = false, bool isHaveColor = true, bool isHeveAttrName = true)
        {
            string color   = GetAttrColor(Type, RealVal);
            string strVal  = GetAttrNumber(Type, RealVal);
            string strSign = "";

            if (isHaveSign)
            {
                strSign = GetAttrSign(RealVal);
            }
            string finalStr = strSign + strVal;

            if (isHeveAttrName)
            {
                finalStr = BaseUIUtils.AttrTypeNameSuffix(finalStr, (Type as Enum));
            }
            string colorFormat = "{0}{1}</color>";

            if (isHaveColor)
            {
                return(string.Format(colorFormat, color, finalStr));
            }
            return(finalStr);
        }