Exemplo n.º 1
0
        /// <summary>
        /// For Fix Value & Range Min
        /// </summary>
        /// <param name="value"></param>
        public void ChangeValue(AssemblePartPropertyDetailInfo info)
        {
            if (detailInfoDic.ContainsKey(info.customDataName))
            {
                var detailInfo = detailInfoDic[info.customDataName];
                if (detailInfo.modifyType == 1)
                {
                    detailInfo.modifyValueFix = info.modifyValueFix;
                }
                else if (detailInfo.modifyType == 2)
                {
                    detailInfo.modifyValueMin = info.modifyValueMin;
                    detailInfo.modifyValueMax = info.modifyValueMax;
                }
            }
            else
            {
                detailInfoDic.Add(info.customDataName, info);
            }

            var propertyData = AssembleModule.GetAssemblePartPropertyTypeData(info.propertyLinkName);

            ValueMin.text = ValueFormat(propertyData, CurrentValueMin);
            ValueMax.text = ValueFormat(propertyData, CurrentValueMax);
        }
Exemplo n.º 2
0
        public void SetUpItem(Config.PartsPropertyConfig.ConfigData config)
        {
            if (config == null)
            {
                return;
            }
            _configData = config;

            if (config.PropertyType == 1)
            {
                ///Fix Value
                ValueMin.gameObject.SetActive(false);
                DotTrans.gameObject.SetActive(false);

                ValueMax.text = ValueFormat(config, (float)config.PropertyValue);
            }
            else if (config.PropertyType == 2)
            {
                ///Value Range
                ValueMin.gameObject.SetActive(true);
                DotTrans.gameObject.SetActive(true);

                ValueMax.text = ValueFormat(config, (float)config.PropertyRangeMax);
                ValueMin.text = ValueFormat(config, (float)config.PropertyRangeMin);
            }

            var typeData = AssembleModule.GetAssemblePartPropertyTypeData(config.Name);

            if (typeData != null)
            {
                transform.FindTransfrom("Icon").SafeGetComponent <Image>().sprite = Utility.LoadSprite(typeData.PropertyIcon);
                transform.FindTransfrom("Name").SafeGetComponent <Text>().text    = MultiLanguage.Instance.GetTextValue(typeData.PropertyName);
            }
        }
Exemplo n.º 3
0
        public void RefreshValue(float value)
        {
            if (string.Compare(_propertyName, "Time") == 0)
            {
                _value.text = string.Format("{0:N1}", value);
                return;
            }
            var type = AssembleModule.GetAssemblePartPropertyTypeData(_propertyName);

            _value.text = ValueFormat(type, value);
        }
Exemplo n.º 4
0
            public CustomData InitData(Config.PartsPropertyConfig.ConfigData config)
            {
                CustomData data = new CustomData();

                propertyName        = config.Name;
                propertyType        = config.PropertyType;
                propertyOriginValue = (float)config.PropertyValue;
                propertyTypeData    = AssembleModule.GetAssemblePartPropertyTypeData(config.Name);
                if (propertyTypeData != null)
                {
                    propertyNameText = MultiLanguage.Instance.GetTextValue(propertyTypeData.PropertyName);
                    propertyIcon     = Utility.LoadSprite(propertyTypeData.PropertyIcon);
                }
                return(data);
            }
Exemplo n.º 5
0
        public void SetUpItem(Sprite icon, string name, float value, string propertyName)
        {
            transform.FindTransfrom("Icon").SafeGetComponent <Image>().sprite = icon;
            transform.FindTransfrom("Name").SafeGetComponent <Text>().text    = name;
            _propertyName = propertyName;
            if (string.Compare(_propertyName, "Time") == 0)
            {
                _value.text = string.Format("{0:N1}", value);
                return;
            }

            var type = AssembleModule.GetAssemblePartPropertyTypeData(_propertyName);

            _value.text = ValueFormat(type, value);
        }
Exemplo n.º 6
0
        void RefreshPartProperty()
        {
            var _partPropertyTrans = transform.FindTransfrom("Content/PartProperty/Content");

            _partPropertyTrans.SafeSetActiveAllChild(false);

            for (int i = 0; i < _model.PresetInfo.partsPropertyConfig.configData.Count; i++)
            {
                if (i > Config.GlobalConfigData.AssemblePart_Max_PropertyNum)
                {
                    break;
                }
                var data  = _model.PresetInfo.partsPropertyConfig.configData[i];
                var trans = _partPropertyTrans.GetChild(i);

                var typeData = AssembleModule.GetAssemblePartPropertyTypeData(data.Name);
                if (typeData != null)
                {
                    trans.FindTransfrom("Icon").SafeGetComponent <Image>().sprite = Utility.LoadSprite(typeData.PropertyIcon);
                    trans.FindTransfrom("Name").SafeGetComponent <Text>().text    = MultiLanguage.Instance.GetTextValue(typeData.PropertyName);
                }
                if (data.PropertyType == 1)
                {
                    ///Set Value Fix
                    trans.FindTransfrom("Value").SafeGetComponent <Text>().text = data.PropertyValue.ToString();
                }
                else if (data.PropertyType == 2)
                {
                    ///Set Value Range
                    trans.FindTransfrom("Value").SafeGetComponent <Text>().text = string.Format("{0} ~ {1}", data.PropertyRangeMin.ToString(), data.PropertyRangeMax.ToString());
                }


                trans.gameObject.SetActive(true);
            }
        }
Exemplo n.º 7
0
        void InitDetialContent()
        {
            contentTrans.ReleaseAllChildObj();
            _propertyItemDic.Clear();

            int diffValue = (int)Math.Round((CurrentValue - _config.CustomDataRangeMin) * 10, 0);

            for (int i = 0; i < _config.propertyLinkData.Count; i++)
            {
                var data = _config.propertyLinkData[i];

                var typeData = AssembleModule.GetAssemblePartPropertyTypeData(data.Name);
                if (typeData == null)
                {
                    continue;
                }

                if (data.PropertyChangeType == 1)
                {
                    if (data.PropertyChangePerUnitValue != 0)
                    {
                        SetUpPropertyItemSmall(
                            Utility.LoadSprite(typeData.PropertyIcon),
                            MultiLanguage.Instance.GetTextValue(typeData.PropertyName),
                            (float)(diffValue * data.PropertyChangePerUnitValue),
                            data.Name);
                    }
                }
                else if (data.PropertyChangeType == 2)
                {
                    if (data.PropertyChangePerUnitMin != 0)
                    {
                        ///Init Min
                        SetUpPropertyItemSmall(
                            Utility.LoadSprite(typeData.PropertyIcon),
                            Utility.ParseStringParams(MultiLanguage.Instance.GetTextValue(AssemblePartPropertyItem_Value_Min_Text),
                                                      new string[] { MultiLanguage.Instance.GetTextValue(typeData.PropertyName) }),
                            (float)(diffValue * data.PropertyChangePerUnitMin),
                            data.Name);
                    }

                    if (data.PropertyChangePerUnitMax != 0)
                    {
                        ///Init Max
                        SetUpPropertyItemSmall(
                            Utility.LoadSprite(typeData.PropertyIcon),
                            Utility.ParseStringParams(MultiLanguage.Instance.GetTextValue(AssemblePartPropertyItem_Value_Max_Text),
                                                      new string[] { MultiLanguage.Instance.GetTextValue(typeData.PropertyName) }),
                            (float)(diffValue * data.PropertyChangePerUnitMax),
                            data.Name);
                    }
                }
            }

            ///Init Time
            if (_config.TimeCostPerUnit != 0)
            {
                SetUpPropertyItemSmall(
                    Utility.LoadSprite(Config.ConfigData.GlobalSetting.General_Time_Icon),
                    MultiLanguage.Instance.GetTextValue(Config.ConfigData.GlobalSetting.General_Time_Cost_TextID),
                    (float)(diffValue * _config.TimeCostPerUnit),
                    "Time");
            }
        }
Exemplo n.º 8
0
        string ValueFormat(Config.PartsPropertyConfig.ConfigData config, float value)
        {
            var propertyData = AssembleModule.GetAssemblePartPropertyTypeData(config.Name);

            return(ValueFormat(propertyData, value));
        }