public StoreData GetStoreData(string Id) { StoreDataList storeDataList = GetStoreDataListByCurrentLanguage(); foreach (StoreData sd in storeDataList._dataList) { if (sd._id == Id) { return(sd); } } return(null); }
public void getProductDatas(string json) { try { StoreDataList obj = JSONSerializer.Deserialize <StoreDataList>(json); if (onGetProductDatas != null) { onGetProductDatas(obj); } } catch (Exception ex) { Log.Error(ex.ToString()); if (onGetProductDatas != null) { onGetProductDatas(null); } } }
public static void Read() { Workbook workbook = Workbook.CreatWorkbook(fileName, sheetName); Sheet sheet = workbook._sheet; if (sheet == null) { Debug.LogError("Can't find " + sheetName + " in " + fileName); return; } bool newFile = false; StoreDataList dataList = null; UnityEngine.Object oldFile = AssetDatabase.LoadAssetAtPath(outFileName, typeof(StoreDataList)); if (oldFile == null) { newFile = true; dataList = ScriptableObject.CreateInstance(typeof(StoreDataList)) as StoreDataList; } else { dataList = oldFile as StoreDataList; } dataList._dataList.Clear(); for (int i = 1; i < sheet._rows.Count; i++) { Row data = sheet._rows[i]; StoreData newData = new StoreData(); newData._id = data["id"]; newData._displayNameIds = data["displayNameIds"]; newData._order = GetInt(data["order"]); newData._isVisibleOnStore = GetBool(data["isVisibleOnStore"]); newData._visibleLevelMin = GetInt(data["visibleLevelMin"]); newData._visibleLevelMax = GetInt(data["visibleLevelMax"]); newData._order = GetInt(data["order"]); newData._visibleStartTime = data["visibleStartTime"]; newData._visibleEndTime = data["visibleEndTime"]; newData._isRecommend = GetBool(data["isRecommend"]); newData._isNew = GetBool(data["isNew"]); newData._discount = GetFloat(data["discount"]); newData._discountStartTime = data["discountStartTime"]; newData._discountEndTime = data["discountEndTime"]; newData._storeType = GetStoreItemType(data["storeType"]); newData._storeIconName = data["storeIconName"]; newData._normalInfo._itemID = data["itemID"]; newData._normalInfo._count = GetInt(data["count"]); newData._normalInfo._hardCurrency = GetInt(data["hardCurrency"]); newData._normalInfo._softCurrency = GetInt(data["softCurrency"]); newData._normalInfo._dissountHardCurrency = GetInt(data["dissountHardCurrency"]); newData._normalInfo._discountSoftCurrency = GetInt(data["discountSoftCurrency"]); newData._iapInfo._iapId = data["iapId"]; newData._iapInfo._iapIdAndroid = data["iapIdAndroid"]; newData._iapInfo._hcCount = GetInt(data["hcCount"]); newData._iapInfo._scCount = GetInt(data["scCount"]); newData._iapInfo._bonusCount = GetInt(data["bonusCount"]); newData._iapInfo._discountHcCount = GetInt(data["discountHcCount"]); newData._iapInfo._discountScCount = GetInt(data["discountScCount"]); newData._iapInfo._discountBonusCount = GetInt(data["discountBonusCount"]); newData._iapInfo._USD_price = GetInt(data["USD_price"]); dataList._dataList.Add(newData); } if (newFile) { AssetDatabase.CreateAsset(dataList, outFileName); } else { EditorUtility.SetDirty(dataList); } }
private void OnGetProductDatas(StoreDataList list) { _isFinishGetNativeProductlist = true; _nativeStoreList = list; }
public void UseOriginalDataList() { _curStoreDataList = _storeDataConfig._globalStoreDataList; }
private void InventoryNumberRangeSearchExecute() { StoreDataList.Clear(); IWorkbook workbook = null; //新建IWorkbook對象 string fileName = string.Concat(AppSettingConfig.FilePath(), "/", AppSettingConfig.StoreManageFileName()); FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); workbook = new XSSFWorkbook(fileStream); //xlsx數據讀入workbook Regex checkStoreAreaPattern = new Regex(string.Concat("(^", StoreArea.Replace(",", ")+|(^"), ")+")); Regex checkExceptAreaPattern = new Regex(string.Concat("(", ExceptArea.Replace(",", ")+|("), ")+")); Regex checkTextileNamePattern = new Regex(string.Concat("(", TextileName.Replace(",", ")+|("), ")+")); for (int sheetCount = 1; sheetCount < workbook.NumberOfSheets; sheetCount++) { ISheet sheet = workbook.GetSheetAt(sheetCount); //獲取第i個工作表 IRow row; // = sheet.GetRow(0); //新建當前工作表行數據 if (!checkTextileNamePattern.IsMatch(sheet.SheetName)) { continue; } var colorList = new List <StoreData>(); for (int rowNumber = 1; rowNumber <= sheet.LastRowNum; rowNumber++) //對工作表每一行 { if (rowNumber > 70) { break; } row = sheet.GetRow(rowNumber); //row讀入第i行數據 if (row != null) { if (row.GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.ColorName) == null) { break; } ICell countInventory = row.GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.CountInventory); if (countInventory == null || string.IsNullOrEmpty(countInventory.ToString()) || (countInventory.CellType == CellType.Formula && countInventory.CachedFormulaResultType == CellType.Error)) { continue; } double cellValue = countInventory.NumericCellValue; //獲取i行j列數據 string storeArea = row.GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.StorageSpaces) == null ? "" : row.GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.StorageSpaces).ToString(); if (cellValue <= MaxNumber && cellValue >= MinNumber && checkStoreAreaPattern.IsMatch(storeArea) && !checkExceptAreaPattern.IsMatch(storeArea)) { colorList.Add(new StoreData { ColorName = row.GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.ColorName) == null ? "" : row.GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.ColorName).ToString(), StoreArea = storeArea, FabricFactory = row.GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.FabricFactory) == null ? "" : row.GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.FabricFactory).ToString(), ClearFactory = row.GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.ClearFactory) == null ? "" : row.GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.ClearFactory).ToString(), CountInventory = cellValue.ToString(), CheckDate = row.GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.CheckDate) == null ? "" : row.GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.CheckDate).ToString() }); } else { continue; } } else { break; } } DateTime result; var soretColorList = colorList.OrderBy(o => o.FabricFactory).ThenBy(o => o.ClearFactory).ThenBy(o => Convert.ToDouble(o.CountInventory)).ThenByDescending(O => DateTime.TryParse(O.CheckDate, out result) == true ? result : DateTime.Now.AddDays(-360)); if (soretColorList.Count() > 0) { StoreDataList.Add(new StoreData { TextileName = sheet.SheetName, ColorName = "", CountInventory = "" }); } foreach (var item in soretColorList) { StoreDataList.Add(item); } } fileStream.Close(); workbook.Close(); }