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); } }
/// <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); }
public bool Create(int id) { if (AssembleModule.GetWarshipDataByKey(id) == null) { return(false); } ID = id; return(true); }
public void AddUnlockAssembleShipID(int shipID) { if (!_currentUnlockShipList.Contains(shipID)) { if (AssembleModule.GetWarshipDataByKey(shipID) != null) { _currentUnlockShipList.Add(shipID); } } }
public void AddUnlockAssemblePartID(int partID) { if (!_currentUnlockPartList.Contains(partID)) { if (AssembleModule.GetAssemblePartDataByKey(partID) != null) { _currentUnlockPartList.Add(partID); } } }
public AssemblePartTypePresetData(int typeModelID) { _partsTypeMeta = AssembleModule.GetAssemblePartTypeByKey(typeModelID); if (_partsTypeMeta != null) { ModelPath = _partsTypeMeta.ModelPath; TypeID = _partsTypeMeta.TypeID; } partsPropertyConfig = AssembleModule.GetPartsPropertyConfigData(typeModelID); }
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); }
public AssembleShipTypePresetData(int warShipID) { _metaData = AssembleModule.GetWarshipDataByKey(warShipID); if (_metaData != null) { WarshipID = _metaData.WarShipID; shipCostBase = AssembleModule.GetShipMaterialCost(_metaData.WarShipID); _metaClass = AssembleModule.GetWarshipClassDataByKey(_metaData.Class); partConfig = AssembleModule.GetShipPartConfigData(warShipID); } }
public static List <int> ParseTechParam_Unlock_Assemble_Ship(string content) { List <int> result = new List <int>(); var list = Utility.TryParseIntList(content, ','); for (int i = 0; i < list.Count; i++) { if (AssembleModule.GetWarshipDataByKey(list[i]) != null) { result.Add(list[i]); } } return(result); }
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); }
public static PlayerAssemblePartData InitData() { PlayerAssemblePartData data = new PlayerAssemblePartData(); var configData = Config.ConfigData.AssembleConfig.assemblePartMainType; for (int i = 0; i < configData.Count; i++) { if (!data.AssemblePartMainTypeDic.ContainsKey(configData[i].Type)) { data.AssemblePartMainTypeDic.Add(configData[i].Type, configData[i]); } } data._currentUnlockPartList = AssembleModule.GetAllUnlockPartTypeID(); return(data); }
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); }
public List <int> GetUnlockAssembleShipTypeListByTypeID(string typeID) { List <int> result = new List <int>(); for (int i = 0; i < _currentUnlockShipList.Count; i++) { var meta = AssembleModule.GetWarshipDataByKey(_currentUnlockShipList[i]); if (meta != null) { if (meta.MainType == typeID) { result.Add(_currentUnlockShipList[i]); } } } return(result); }
public bool InitData(int partID) { this.partID = partID; _partsMeta = AssembleModule.GetAssemblePartDataByKey(partID); if (_partsMeta != null) { baseTimeCost = _partsMeta.BaseTimeCost; materialCostItem = AssembleModule.GetPartMaterialCost(partID); partsConfig = AssembleModule.GetPartsCustomConfigData(partID); partEquipType = AssembleModule.GetAssemblePartEquipType(partID); typePresetData = new AssemblePartTypePresetData(_partsMeta.ModelTypeID); modifierRootType = AssembleModule.FetchAssemblePartModifieRootType(typePresetData.TypeID); return(true); } return(false); }
/// <summary> /// GameSave /// </summary> /// <param name="saveData"></param> public bool LoadCustomDataSave(AssmeblePartCustomSaveData saveData) { var config = AssembleModule.GetPartsPropertyConfigData(saveData.partID); if (config != null) { var proConfig = config.configData.Find(x => x.Name == saveData.propertyName); if (proConfig != null) { CustomData data = new CustomData(); data.InitData(proConfig); propertyValueMin = saveData.propertyValueMin; propertyValueMax = saveData.propertyValueMax; detailInfoDic = saveData.detailInfoDic; timeCostDetailInfoDic = saveData.timeCostDetailInfoDic; return(true); } } return(false); }
public List <int> GetUnlockAssemblePartTypeListByTypeID(string typeID) { List <int> result = new List <int>(); for (int i = 0; i < _currentUnlockPartList.Count; i++) { var meta = AssembleModule.GetAssemblePartDataByKey(_currentUnlockPartList[i]); if (meta != null) { var typeMeta = AssembleModule.GetAssemblePartTypeByKey(meta.ModelTypeID); if (typeMeta != null) { if (typeMeta.TypeID == typeID) { result.Add(_currentUnlockPartList[i]); } } } } return(result); }
void RefreshPartCost() { var _partCostTrans = transform.FindTransfrom("Content/PartCost/Content"); _partCostTrans.SafeSetActiveAllChild(false); var costList = AssembleModule.GetPartMaterialCost(_model.ID); for (int i = 0; i < costList.Count; i++) { if (i > Config.GlobalConfigData.Assemble_MaterialCost_MaxNum) { break; } var cmpt = UIUtility.SafeGetComponent <MaterialCostCmpt>(_partCostTrans.GetChild(i)); if (cmpt != null) { cmpt.SetUpItem(costList[i]); cmpt.gameObject.SetActive(true); } } }
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); } }
void RefreshPartEquipTarget() { var _partEquipTargetTrans = transform.FindTransfrom("Content/PartEquipTarget/Content"); _partEquipTargetTrans.SafeSetActiveAllChild(false); var equipType = AssembleModule.GetAssemblePartEquipType(_model.ID); for (int i = 0; i < equipType.Count; i++) { if (i > Config.GlobalConfigData.AssemblePart_Target_MaxNum) { break; } var equipData = AssembleModule.GetAssembleMainTypeData(equipType[i].ToString()); if (equipData != null) { var trans = _partEquipTargetTrans.GetChild(i); trans.FindTransfrom("Icon").SafeGetComponent <Image>().sprite = Utility.LoadSprite(equipData.IconPath); trans.FindTransfrom("Name").SafeGetComponent <Text>().text = MultiLanguage.Instance.GetTextValue(equipData.TypeNameText); trans.gameObject.SetActive(true); } } }
private void InitUnlockAssembleShipList() { _currentUnlockShipList = AssembleModule.GetAllUnlockShipPresetID(); }
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"); } }
string ValueFormat(Config.PartsPropertyConfig.ConfigData config, float value) { var propertyData = AssembleModule.GetAssemblePartPropertyTypeData(config.Name); return(ValueFormat(propertyData, value)); }