public static Dictionary <Type, IDictionary> Init(byte[] _bytes) { MemoryStream ms = new MemoryStream(_bytes); BinaryReader br = new BinaryReader(ms); Dictionary <Type, IDictionary> dic = new Dictionary <Type, IDictionary>(); Dictionary <int, DishSDS> DishSDSDic = new Dictionary <int, DishSDS>(); int lengthDishSDS = br.ReadInt32(); for (int i = 0; i < lengthDishSDS; i++) { DishSDS unit = new DishSDS(); DishSDS_c.Init(unit, br); unit.Fix(); DishSDSDic.Add(unit.ID, unit); } dic.Add(typeof(DishSDS), DishSDSDic); Dictionary <int, ResultSDS> ResultSDSDic = new Dictionary <int, ResultSDS>(); int lengthResultSDS = br.ReadInt32(); for (int i = 0; i < lengthResultSDS; i++) { ResultSDS unit = new ResultSDS(); ResultSDS_c.Init(unit, br); unit.Fix(); ResultSDSDic.Add(unit.ID, unit); } dic.Add(typeof(ResultSDS), ResultSDSDic); br.Close(); ms.Close(); ms.Dispose(); return(dic); }
void Awake() { Instance = this; Log.Init(Debug.Log); Dictionary <int, DishSDS> dic = StaticData.GetDic <DishSDS>(); IEnumerator <DishSDS> enumerator = dic.Values.GetEnumerator(); while (enumerator.MoveNext()) { DishSDS sds = enumerator.Current; float time = sds.prepareTime + sds.cookTime + sds.optimizeTime; if (time > MAX_TIME) { MAX_TIME = time; } } TICK_SPAN = 1.0f / CookConst.TICK_NUM_PER_SECOND; Cook_client.Init(dic, StaticData.GetDic <ResultSDS>()); client = new Cook_client(); client.Init(this); GameObject go = GameObjectFactory.Instance.GetGameObject("Assets/Resource/prefab/playerDataUnit.prefab", null); go.transform.SetParent(mPlayerDataContainer, false); mPlayerData = go.GetComponent <PlayerDataUnit>(); mPlayerData.Init(this, true); go = GameObjectFactory.Instance.GetGameObject("Assets/Resource/prefab/playerDataUnit.prefab", null); go.transform.SetParent(oPlayerDataContainer, false); oPlayerData = go.GetComponent <PlayerDataUnit>(); oPlayerData.Init(this, false); go = GameObjectFactory.Instance.GetGameObject("Assets/Resource/prefab/requirementContainer.prefab", null); go.transform.SetParent(requirementContainerContainer, false); requirementContainer = go.GetComponent <RequirementContainer>(); requirementContainer.Init(this, client.GetRequirement()); bg.Init(this); gameObject.SetActive(false); }
public static void Init(DishSDS _csv, BinaryReader _br) { _csv.ID = _br.ReadInt32(); _csv.resultID = _br.ReadInt32(); _csv.cookTime = _br.ReadSingle(); _csv.optimizeDecreaseValue = _br.ReadSingle(); _csv.optimizeTime = _br.ReadSingle(); _csv.prepareDecreaseValue = _br.ReadSingle(); _csv.prepareTime = _br.ReadSingle(); }