static void LoadMissionData(string path,MasterShop data) { using (FileStream stream = File.Open(path, FileMode.Open, FileAccess.Read)) { IWorkbook book = new HSSFWorkbook(stream); ISheet sheet = book.GetSheetAt(0); Debug.Log(sheet.SheetName); IRow row0 = sheet.GetRow(0); //一番最初のフィールドは見出しなので無視 for (int i = 1; i < sheet.LastRowNum; i++) { IRow row = sheet.GetRow(i); //エクセルデータを編集したらこことMasterCharacterに追加すれば更新できるよ MasterShop.param p = new MasterShop.param(); p.id = (int)row.GetCell(0).NumericCellValue; p.name = row.GetCell(1).StringCellValue; p.subscripsion = row.GetCell(2).StringCellValue; p.gold = (int)row.GetCell(3).NumericCellValue; p.hot = (int)row.GetCell(4).NumericCellValue; p.stress = (int)row.GetCell(5).NumericCellValue; p.category = (int)row.GetCell(6).NumericCellValue; p.res = row.GetCell(7).StringCellValue; p.color = row.GetCell(8).StringCellValue; p.gread = (int)row.GetCell(9).NumericCellValue; data.list.Add(p); } } }
public static void CreateShopDialog( Transform parent,MasterShop.param data,System.Action oncomplete=null,System.Action onremove=null) { GameObject g=MonoBehaviour.Instantiate(GameManager.Get.Resource.GetPrefab("ShopDialog")); string text = data.name + "は" + data.gold + "ゴールド"+"\n"+"かかります。\n" + "購入しますか?"; if (data.category == 0) text = "この卵を" + data.name + "ますか?"; g.transform.FindChild("maintext").GetComponent<Text>().text = text; if (GameManager.Get.user.gold < data.gold) { g.transform.FindChild("bt_ok").GetComponent<Button>().transition = Selectable.Transition.ColorTint; g.transform.FindChild("bt_ok").GetComponent<Button>().interactable = false; } g.transform.FindChild("bt_ok").GetComponent<Button>().onClick.AddListener(() => { if (oncomplete != null) oncomplete(); GameManager.Get.AddGold(-(data.gold)); UIController.m_dialogController.RemoveDialog(); CommonFile.push(); }); g.transform.FindChild("bt_no").GetComponent<Button>().onClick.AddListener(()=>{ if (onremove != null) onremove(); UIController.m_dialogController.RemoveDialog(); CommonFile.push(); }); g.transform.SetParent(parent, false); g.GetComponent<UIController>().InitDialog(); }
public void SetEquipment(EquipmentType type,string res,Color c,MasterShop.param data) { if (EquipmentType.Hand == type) { switch(data.gread){ case 0://撫でる GameObject.FindGameObjectWithTag("Player").GetComponent<EggStatus>().Hot+=data.hot; break; case 1://つく GameObject.FindGameObjectWithTag("Player").GetComponent<EggStatus>().Stres+=data.stress; break; case 2://割る GameObject.FindGameObjectWithTag("Player").GetComponent<EggStatus>().EggHP-=1; EffectCreater.CreateShockwave(EquipmentPointSystem.Get.HandPoint); break; } } if (EquipmentType.Lag == type) { GameObject g = Instantiate(GameManager.Get.Resource.GetPrefab(res)) as GameObject; g.transform.localScale = new Vector3(0, 1, 1); g.GetComponent<Image>().color = c; g.transform.SetParent(EquipmentPointSystem.Get.LagPiont, false); g.GetComponent<Equipment>().SetParam(data); LeanTween.scaleX(g, 1, 0.2f); } if (EquipmentType.Light == type) { //ライトの処理 GameObject g = Instantiate(GameManager.Get.Resource.GetPrefab(res)) as GameObject; Vector2 pos = g.transform.localPosition; g.transform.localPosition = g.transform.localPosition + new Vector3(-200, 0,0); g.GetComponent<Image>().color = c; g.transform.SetParent(EquipmentPointSystem.Get.LightPoint, false); g.GetComponent<Equipment>().SetParam(data); LeanTween.moveLocal(g, pos, 0.2f); } if(EquipmentType.Drag== type) { //ドラッグの処理 EggStatus states = GameObject.FindGameObjectWithTag("Player").GetComponent<EggStatus>(); EffectCreater.CreateStrokeEffect2(EquipmentPointSystem.Get.HandPoint); states.Hot += data.hot; states.Stres += data.stress; } }
public void NodeClick(EquipmentGridType type,EquipmentGrid grid,MasterShop.param data) { CommonFile.push(); if (type == EquipmentGridType.Category) { grid.ChangeGrid(EquipmentGridType.Item,this.type); } if (type == EquipmentGridType.Item) { int category = data.category; DialogCreater.CreateShopDialog(CanvasList.Get.GetCanvas(CanvasType.FrontCanvas).point.transform, data,()=> { SetEquipment((EquipmentType)data.category,data.res,data.GetColor(),data); }); } }
public void SetParam(MasterShop.param p) { parametor = p; }
public void LoadData() { m_characters = Resources.Load<MasterCharacter>("MasterData/Data/MasterCharacter.xls"); m_shop = Resources.Load<MasterShop>("MasterData/Data/MasterShop.xls"); }