void creatRewards() { rewardList = new Dictionary <string, int> (); if (taskId == "random") { int expCount = 0; int coin = 0; foreach (TaskItem item in requireList.Values) { FishItemSpec fSpec = SpecController.getItemById(item.item_id) as FishItemSpec; expCount += fSpec.common * 5; coin += fSpec.coin * item.total * 2; } rewardList.Add("exp", expCount); rewardList.Add("coin", coin); } else { List <OwnedItem> specrewardList = getTaskSpec().getRewardList(); foreach (OwnedItem item in specrewardList) { rewardList.Add(item.item_id, item.count); } } setSaveData(); }
public void init(string landName) { transform.Find("TitleText").GetComponent <Text> ().text = LanController.getString(landName); transform.Find("IslandIcon").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + "IslandIcon04"); GameObject listItemRender = transform.Find("FishList").Find("FishRender").gameObject; GameObject listGrid = transform.Find("FishList").Find("Grid").gameObject; Dictionary <string, ItemSpec> fishes = getFishTypes(landName); foreach (string key in fishes.Keys) { GameObject bt = Instantiate(listItemRender); bt.GetComponent <RectTransform>().SetParent(listGrid.GetComponent <RectTransform>()); ItemSpec spec = SpecController.getItemById(key); bt.SetActive(true); bt.GetComponent <RectTransform>().localScale = Vector3.one; //调整大小 bt.GetComponent <RectTransform>().localPosition = Vector3.zero; //调整位置 bt.name = spec.item_id; bt.transform.Find("CountText").gameObject.GetComponent <Text> ().text = ""; bt.transform.Find("Icon").gameObject.GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + spec.name + "Icon"); } int p = 4; int t = (fishes.Count % p) == 0 ? (fishes.Count / p) : ((fishes.Count / p) + 1); int h = t * 100 + (t - 1) * 10 + 20; listGrid.GetComponent <RectTransform>().sizeDelta = new Vector2(500, h); listGrid.transform.Translate(new Vector3(0, -h / 2, 0)); transform.Find("FightButton").Find("Text").GetComponent <Text> ().text = LanController.getString("attack").ToUpper(); }
// Update is called once per frame public void Refresh() { coins = 0; fishList = transform.Find("FishList").gameObject; listItemRender = fishList.transform.Find("FishRender").gameObject; coinPart = transform.Find("CoinButton"); listGrid = fishList.transform.Find("Grid").gameObject; for (int i = 0; i < listGrid.transform.childCount; i++) { Destroy(listGrid.transform.GetChild(i).gameObject); } notText = transform.Find("NotText").gameObject; petExp = BattleController.GetInstance().getPetCatchExp(); petExpText.text = petExp.ToString(); notText.GetComponent <Text> ().text = LanController.getString("notFish"); Dictionary <string, int> fishes = BattleController.GetInstance().catchFishes; if (fishes.Count <= 0) { notText.SetActive(true); coinPart.gameObject.SetActive(false); finishBut.SetActive(true); } else { notText.SetActive(false); coinPart.gameObject.SetActive(true); finishBut.SetActive(false); foreach (string key in fishes.Keys) { int count = fishes [key]; GameObject bt = Instantiate(listItemRender); bt.GetComponent <RectTransform>().SetParent(listGrid.GetComponent <RectTransform>()); ItemSpec spec = SpecController.getItemById(key); bt.SetActive(true); bt.GetComponent <RectTransform>().localScale = Vector3.one; //调整大小 bt.GetComponent <RectTransform>().localPosition = Vector3.zero; //调整位置 bt.name = spec.item_id; bt.transform.Find("CountText").gameObject.GetComponent <Text> ().text = "" + count; bt.transform.Find("Icon").gameObject.GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + spec.name + "Icon"); coins += spec.coin * count; } int p = 4; int t = (fishes.Count % p) == 0 ? (fishes.Count / p) : ((fishes.Count / p) + 1); int h = t * 100 + (t - 1) * 10 + 20; listGrid.GetComponent <RectTransform>().sizeDelta = new Vector2(500, h); listGrid.transform.Translate(new Vector3(0, -h / 2, 0)); coinPart.Find("Text").GetComponent <Text>().text = "" + coins; } }
void setPetData(PetEggData data) { fishIcon = transform.Find("SkinImage").Find("FishPart").Find("Icon").GetComponent <Image>(); LeftBut = transform.Find("SkinImage").Find("LButton").gameObject; RightBut = transform.Find("SkinImage").Find("RButton").gameObject; ConfirmBut = transform.Find("SkinImage").Find("ConfirmButton").gameObject; timePartText = transform.Find("SkinImage").Find("TimePart").Find("Text").GetComponent <Text>(); GameObject steppart = transform.Find("SkinImage").Find("StepPart").gameObject; if (data.item_id == "20001") { steppart.SetActive(false); } else { steppart.SetActive(true); steppart.transform.Find("text").GetComponent <Text> ().text = (curIndex + 1).ToString(); } spec = SpecController.getItemById(data.item_id); fishIcon.sprite = GameController.GetInstance().getSpByName("Pic/ui/" + spec.name + "Icon"); curPetData = data; if (spec is FishItemSpec) { TimeSpan leftTime = data.getLeftTime(); if (leftTime.TotalSeconds <= 0) { itemType = TYPE_OUT; ConfirmBut.transform.Find("Text").GetComponent <Text> ().text = LanController.getString("setout").ToUpper(); timePartText.text = LanController.getString("PetOutMes").ToUpper(); } else { itemType = TYPE_SPEED; timePartText.text = leftTime.ToString(); ConfirmBut.transform.Find("Text").GetComponent <Text> ().text = LanController.getString("speedup").ToUpper(); } } else { OwnedItem item = PlayerData.getOwnedItem(spec.item_id); if (item.count > 0) { itemType = TYPE_USE; timePartText.text = LanController.getString("randomPetEgg"); ConfirmBut.transform.Find("Text").GetComponent <Text> ().text = LanController.getString("open").ToUpper(); } else { itemType = TYPE_BUY; timePartText.text = LanController.getString("buyEggCase"); ConfirmBut.transform.Find("Text").GetComponent <Text> ().text = LanController.getString("buy").ToUpper(); } } }
//mission fish public static List <FishData> getMissionFishList(MissionFishData data) { List <FishData> fishList = new List <FishData>(); Vector2 bounds = GameController.WorldBound; FishItemSpec spec = SpecController.getItemById(data.item_id) as FishItemSpec; GameObject fishObj = GameController.GetInstance().getPrefab(spec.name); string lC = data.levelCount; string[] arr = lC.Split(new char[1] { '|' }); float t = bounds.x * 0.1f; for (int j = 0; j < arr.Length; j++) { string[] arr1 = arr[j].Split(new char[1] { ':' }); int c = Mathf.FloorToInt(int.Parse(arr1 [1]) / 2) + 1; for (int i = 0; i < c; i++) { if (i == 0) { fishList.Add(new FishData(spec, new Vector3(0, -1, 0), new Vector3(0, bounds.y * 1.2f, 0), j * 2 + (i + 1) * 0.5f, 50, 0)); } else { fishList.Add(new FishData(spec, new Vector3(0, -1, 0), new Vector3(i * t, bounds.y * 1.2f, 0), j * 2 + (i + 1) * 0.5f, 50, 0)); fishList.Add(new FishData(spec, new Vector3(0, -1, 0), new Vector3(-i * t, bounds.y * 1.2f, 0), j * 2 + (i + 1) * 0.5f, 50, 0)); } } } return(fishList); }
//箭头形状 private static List <FishData> creatA(List <string> fishArr, Vector3 direction, int spacetime, int wavetime, int speed, int waves = 1) { List <FishData> fishList = new List <FishData>(); FishItemSpec spec; Vector2 bounds = GameController.WorldBound; float t = bounds.y * 0.7f / fishArr.Count; for (int w = 0; w < waves; w++) { for (int i = 0; i < fishArr.Count; i++) { spec = SpecController.getItemById(fishArr[i]) as FishItemSpec; if (i == 0) { fishList.Add(new FishData(spec, direction, new Vector3(bounds.x, 0, 0), w * wavetime + (i + 1) * spacetime, speed, 0)); } else { fishList.Add(new FishData(spec, direction, new Vector3(bounds.x, i * t, 0), w * wavetime + (i + 1) * spacetime, speed, 0)); fishList.Add(new FishData(spec, direction, new Vector3(bounds.x, -i * t, 0), w * wavetime + (i + 1) * spacetime, speed, 0)); } } } return(fishList); }
public void finishTask(string id) { if (CurrentScene == LOGINSCENE) { LoginController.GetInstance().initTreasure(); } if (id == "random") { PlayerData.setCurTask(null); } else { string nextId = (int.Parse(id) + 1).ToString(); TaskItemSpec nextSpec = SpecController.getItemById(nextId) as TaskItemSpec; if (nextSpec != null) { addTask(nextId); } else { PlayerData.setCurTask(null); creatMyShip(); if (id == "70003") { creatMyShip(); if (CurrentScene == LOGINSCENE) { LoginController.GetInstance().initShipButton(); } } } } }
public void init(HomeObject obj) { hObject = obj; FishItemSpec spec = SpecController.getItemById(obj.trappedId) as FishItemSpec; transform.Find("Fish").GetComponent <Animator> ().Play(spec.name); }
public FishItemSpec getSpec() { if (_spec == null) { _spec = SpecController.getItemById(item_id) as FishItemSpec; } return(_spec); }
private FishItemSpec getSpec() { if (spec == null) { spec = SpecController.getItemById(item_id) as FishItemSpec; } return(spec); }
public void init(MissionFishData data, Vector3 _landPos) { fishData = data; FishItemSpec spec = SpecController.getItemById(data.item_id) as FishItemSpec; transform.Find("Fish").GetComponent <Animator> ().Play(spec.name); landPos = _landPos; mainRig = GetComponent <Rigidbody2D> (); getNewForce(); }
// Use this for initialization void Start() { GameObject listItemRender = transform.Find("ItemList").Find("ItemRender").gameObject; GameObject listGrid = transform.Find("ItemList").Find("Grid").gameObject; foreach (OwnedItem item in list) { GameObject bt = Instantiate(listItemRender); bt.GetComponent <RectTransform>().SetParent(listGrid.GetComponent <RectTransform>()); bt.GetComponent <RectTransform>().localScale = Vector3.one; //调整大小 bt.GetComponent <RectTransform>().localPosition = Vector3.zero; //调整位置 bt.SetActive(true); bt.transform.Find("CountText").GetComponent <Text> ().text = "×" + item.count.ToString(); if (item.item_id == "gem") { bt.transform.Find("Icon").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + "gemIcon"); PlayerData.setgem(PlayerData.getgem() + item.count); } else if (item.item_id == "coin") { bt.transform.Find("Icon").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + "CoinIcon"); PlayerData.setcoin(PlayerData.getcoin() + item.count); } else if (item.item_id == "exp") { bt.transform.Find("Icon").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + "ExpIcon"); PlayerData.setFishExp(PlayerData.getFishExp() + item.count); } else if (item.item_id == "bullet") { bt.transform.Find("Icon").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + "BulletShopIcon"); PlayerData.addBulletCount(item.count); } else { ItemSpec spec = SpecController.getItemById(item.item_id); bt.transform.Find("Icon").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + spec.name + "Icon"); } } transform.Find("Button").Find("Text").GetComponent <Text> ().text = LanController.getString("confirm").ToUpper(); transform.Find("MessagePanel").Find("Text").GetComponent <Text> ().text = message; int t = list.Count; float h = Mathf.Max(t * 100 + (t - 1) * 10 + 20, 400); listGrid.GetComponent <RectTransform>().sizeDelta = new Vector2(h, 146); listGrid.transform.Translate(new Vector3(-h / 2, 0, 0)); }
// Use this for initialization void Start() { itemList = transform.Find("ItemList").Find("Grid").gameObject; ItemInfo = transform.Find("ItemInfoPanel").gameObject; transform.Find("TitleText").GetComponent <Text>().text = LanController.getString("shop").ToUpper(); listItemRender = transform.Find("ItemList").Find("ShopItemRender").gameObject; treasureDic = SpecController.getGroup(TreasureTab); bulletDic = SpecController.getGroup(BulletTab); bulletItemDic = SpecController.getGroup(BulletItemTab); cannonDic = SpecController.getGroup(CannonTab); showItemList(); }
//添加宠物 public void addPet(string id) { Dictionary <string, ItemSpec> dic = SpecController.getGroup("Fish"); string[] dicNames = new string[dic.Count]; dic.Keys.CopyTo(dicNames, 0); PetData petData = new PetData(); petData.initId(PlayerData.creatPetId(), id); petData.curHeart = 2000; PlayerData.addPet(petData); LoginController.GetInstance().creatNewPet(petData); }
public void init(MissionFishData data) { fishData = data; FishItemSpec spec = SpecController.getItemById(data.item_id) as FishItemSpec; if (spec != null) { transform.Find("Icon").GetComponent <Image> ().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + spec.name + "Icon"); } EndTimeText = transform.Find("TimeText").GetComponent <Text> (); GameObject render = transform.Find("FishPart").Find("Render").gameObject; GameObject listView = transform.Find("FishPart").Find("Viewport").gameObject; for (int i = 0; i < listView.transform.childCount; i++) { GameObject go = listView.transform.GetChild(i).gameObject; Destroy(go); } string lC = data.levelCount; string[] arr = lC.Split(new char[1] { '|' }); foreach (string str in arr) { string[] arr1 = str.Split(new char[1] { ':' }); GameObject newRender = Instantiate(render); newRender.GetComponent <RectTransform>().SetParent(listView.GetComponent <RectTransform>()); newRender.GetComponent <RectTransform>().localScale = Vector3.one; //调整大小 newRender.GetComponent <RectTransform>().localPosition = Vector3.zero; //调整位置 newRender.SetActive(true); newRender.transform.Find("LevelText").GetComponent <Text> ().text = arr1 [0].ToString(); newRender.transform.Find("Text").GetComponent <Text> ().text = "×" + arr1 [1].ToString(); newRender.transform.Find("Icon").GetComponent <Image> ().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + spec.name + "Icon"); } int t = arr.Length; float h = Mathf.Max(t * 60 + (t - 1) * 5 + 20, 240); listView.GetComponent <RectTransform>().sizeDelta = new Vector2(280, h); listView.transform.Translate(new Vector3(0, -h / 2, 0)); refreshEndTime(); }
Dictionary <string, ItemSpec> getFishTypes(string landName) { Dictionary <string, ItemSpec> fishes = SpecController.getGroup("Fish"); Dictionary <string, ItemSpec> newFishes = new Dictionary <string, ItemSpec> (); foreach (string key in fishes.Keys) { FishItemSpec spec = fishes[key] as FishItemSpec; if (spec.common == 1 || spec.common == 2 || spec.common == 3) { newFishes.Add(key, spec); } } return(newFishes); }
public void initCannon() { if (curCannon) { Destroy(curCannon); } curCannonSpec = SpecController.getItemById(PlayerData.getCurrentCannon()) as CannonItemSpec; CannonLevelMax = curCannonSpec.maxLevel; curCannon = (GameObject)Instantiate(GameController.GetInstance().getPrefab(curCannonSpec.name), new Vector3(0, 0, 0), Quaternion.identity, cannonCanvas.transform); curCannon.name = "MyCannon"; curCannon.GetComponent <MyCannon> ().init(curCannonSpec); Vector3 v2 = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width / 2, 0, 0)); v2.z = GameController.fishCannon_z; curCannon.transform.position = v2; }
int getCatchFishCoin() { int rewardCoin = 0; ItemSpec spec; foreach (string key in petCatchFishes.Keys) { int count = petCatchFishes [key]; spec = SpecController.getItemById(key); rewardCoin += spec.coin * count; } foreach (string key in catchFishes.Keys) { int count = catchFishes [key]; spec = SpecController.getItemById(key); rewardCoin += spec.coin * count; } return(rewardCoin); }
public int getPetCatchExp() { int rewardExp = 0; ItemSpec spec; foreach (string key in petCatchFishes.Keys) { int count = petCatchFishes [key]; spec = SpecController.getItemById(key); rewardExp += spec.common * count * 3; } foreach (string key in catchFishes.Keys) { int count = catchFishes [key]; spec = SpecController.getItemById(key); rewardExp += spec.common * count; } return(rewardExp); }
public void NewRecipe() { CommonOpenFileDialog dialog = new CommonOpenFileDialog { IsFolderPicker = true, }; if (dialog.ShowDialog() == CommonFileDialogResult.Ok) { Recipe newRecipe = _container.Resolve <Recipe>(); newRecipe.Name = "Test"; newRecipe.Path = dialog.FileName; foreach (string name in Properties.Settings.Default.DrawingNames) { DrawingController newController = _container.Resolve <DrawingController>( name, new ResolverOverride[] { new ParameterOverride("drawing", _container.Resolve <IDrawing>(name)), }); newRecipe.DrawingControllerMap.Add(name, newController); } foreach (string name in Properties.Settings.Default.AlgorithmNames) { SpecController newController = _container.Resolve <SpecController>( new ResolverOverride[] { new ParameterOverride("spec", _container.Resolve <ISpec>(name)) }); newRecipe.SpecControllerMap.Add(name, newController); } CurrentRecipe = newRecipe; } }
private static Dictionary <int, List <FishItemSpec> > getFishDic() { if (fishDic == null) { fishDic = new Dictionary <int, List <FishItemSpec> > (); Dictionary <string, ItemSpec> dic = SpecController.getGroup("Fish"); foreach (ItemSpec spec in dic.Values) { int com = (spec as FishItemSpec).common; if (fishDic.ContainsKey(com)) { fishDic [com].Add(spec as FishItemSpec); } else { fishDic.Add(com, new List <FishItemSpec> () { spec as FishItemSpec }); } } } return(fishDic); }
public void initBullet() { curBulletSpec = SpecController.getItemById(PlayerData.getCurrentBullet()) as BulletItemSpec; }
void showItemInfo(string id) { itemId = id; ItemSpec spec = SpecController.getItemById(id); curInfoSpec = spec; ItemInfo.transform.Find("ItemImage").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + spec.name + "Icon"); ItemInfo.transform.Find("NameText").gameObject.GetComponent <Text> ().text = LanController.getString(spec.name).ToUpper(); ItemInfo.SetActive(true); GameObject buyBut = ItemInfo.transform.Find("BuyButton").gameObject; GameObject useBut = ItemInfo.transform.Find("UseButton").gameObject; useBut.transform.Find("Text").GetComponent <Text>().text = LanController.getString("use").ToUpper(); GameObject treasurePartGrid = ItemInfo.transform.Find("TreasurePart").Find("Grid").gameObject; GameObject iconPart = ItemInfo.transform.Find("TreasurePart").Find("Icon").gameObject; iconPart.SetActive(false); ItemInfo.transform.Find("message").GetComponent <Text> ().text = spec.getMessage(); buyBut.SetActive(false); useBut.SetActive(false); int cost = 10000; if (spec.gem > 0) { cost = spec.gem; buyBut.transform.Find("Image").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/gemIcon"); } else { cost = spec.coin; buyBut.transform.Find("Image").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/CoinIcon"); } List <string[]> list = new List <string[]> (); if (spec.getItemType() == SpecController.TreasureType) { if (spec.gem > 0) { list.Add(new string[] { "gemIcon", "×" + cost }); } else { list.Add(new string[] { "CoinIcon", "×" + cost }); } useBut.SetActive(true); TreasureData treasure = GameController.GetInstance().treasureDatas [spec.item_id]; if (treasure == null || !GameController.GetInstance().IsPaymentInitialized()) { useBut.transform.Find("Text").GetComponent <Text> ().text = LanController.getString("buy").ToUpper(); } else { useBut.transform.Find("Text").GetComponent <Text> ().text = treasure.priceString; } } else { bool owned = false; if (spec.getItemType() == SpecController.BulletType) { list.Add(new string[] { "AttackTipIcon", (spec as BulletItemSpec).attack.ToString() }); list.Add(new string[] { "frozen", (spec as BulletItemSpec).speed.ToString() }); List <string> bullets = PlayerData.getBullets(); if (bullets.Contains(spec.item_id)) { owned = true; if (PlayerData.getCurrentBullet() == spec.item_id) { useBut.transform.Find("Text").GetComponent <Text>().text = LanController.getString("using").ToUpper(); } } } else if (spec.getItemType() == SpecController.CannonType) { list.Add(new string[] { "ExpIcon", (spec as CannonItemSpec).maxLevel.ToString() }); list.Add(new string[] { "AttackTipIcon", "+" + (spec as CannonItemSpec).attack.ToString() + "%" }); list.Add(new string[] { "frozen", "+" + (spec as CannonItemSpec).attackSpeed.ToString() + "%" }); List <string> cannons = PlayerData.getCannons(); if (cannons.Contains(spec.item_id)) { owned = true; if (PlayerData.getCurrentCannon() == spec.item_id) { useBut.transform.Find("Text").GetComponent <Text>().text = LanController.getString("using").ToUpper(); } } } else if (spec.getItemType() == SpecController.BulletItemType) { list.Add(new string[] { "BulletShopIcon", "×" + spec.count.ToString() }); } if (owned) { useBut.SetActive(true); } else { buyBut.transform.Find("Text").GetComponent <Text> ().text = cost.ToString(); buyBut.SetActive(true); } } for (int i = 0; i < treasurePartGrid.transform.childCount; i++) { GameObject go = treasurePartGrid.transform.GetChild(i).gameObject; Destroy(go); } foreach (string[] l in list) { GameObject bt = (GameObject)Instantiate(iconPart, Vector3.zero, Quaternion.identity, treasurePartGrid.GetComponent <RectTransform>()); bt.transform.Find("Image").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + l[0]); bt.transform.Find("Text").GetComponent <Text>().text = l[1]; bt.SetActive(true); } }
void configTask() { if (taskdata.taskId == "random") { transform.Find("TaskName").GetComponent <Text> ().text = LanController.getString("randomTask").ToUpper(); } else { TaskItemSpec taskspec = taskdata.getTaskSpec(); transform.Find("TaskName").GetComponent <Text> ().text = LanController.getString(taskspec.name).ToUpper(); } for (int i = 0; i < requireGrid.transform.childCount; i++) { GameObject go = requireGrid.transform.GetChild(i).gameObject; Destroy(go); } for (int i = 0; i < rewardGrid.transform.childCount; i++) { GameObject to = rewardGrid.transform.GetChild(i).gameObject; Destroy(to); } requireList = taskdata.getRequireList(); rewardList = taskdata.getRewardList(); hasFinished = true; foreach (string id in requireList.Keys) { GameObject bt = Instantiate(requireRender); bt.GetComponent <RectTransform>().SetParent(requireGrid.GetComponent <RectTransform>()); bt.GetComponent <RectTransform>().localScale = Vector3.one; //调整大小 bt.GetComponent <RectTransform>().localPosition = Vector3.zero; //调整位置 bt.SetActive(true); TaskItem taskItem = requireList [id]; GameObject completeIcon = bt.transform.Find("CompletIcon").gameObject; int completeC = Mathf.Min(taskItem.finished, taskItem.total); bt.transform.Find("CompleteText").GetComponent <Text> ().text = completeC.ToString(); bt.transform.Find("TotalText").GetComponent <Text> ().text = "/" + taskItem.total.ToString(); if (taskItem.beFinished()) { completeIcon.SetActive(true); } else { completeIcon.SetActive(false); hasFinished = false; } ItemSpec spec = SpecController.getItemById(id); bt.transform.Find("Icon").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + spec.name + "Icon"); } int t = (requireList.Count % 2) == 0 ? (requireList.Count / 2) : ((requireList.Count / 2) + 1); float h = t * 120 + (t - 1) * 10 + 20; requireGrid.GetComponent <RectTransform>().sizeDelta = new Vector2(requireGrid.GetComponent <RectTransform>().sizeDelta.x, h); requireGrid.transform.Translate(new Vector3(0, -h / 2, 0)); foreach (string key in rewardList.Keys) { GameObject bt = Instantiate(rewardRender); bt.GetComponent <RectTransform>().SetParent(rewardGrid.GetComponent <RectTransform>()); bt.GetComponent <RectTransform>().localScale = Vector3.one; //调整大小 bt.GetComponent <RectTransform>().localPosition = Vector3.zero; //调整位置 bt.SetActive(true); bt.transform.Find("Text").GetComponent <Text> ().text = "×" + rewardList[key].ToString(); if (key == "gem") { bt.transform.Find("Icon").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + "gemIcon"); } else if (key == "coin") { bt.transform.Find("Icon").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + "CoinIcon"); } else if (key == "bullet") { bt.transform.Find("Icon").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + "BulletShopIcon"); } else if (key == "exp") { bt.transform.Find("Icon").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + "ExpIcon"); } else if (key == "ship") { bt.transform.Find("Icon").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + "PirateBoat"); } else { ItemSpec spec = SpecController.getItemById(key); bt.transform.Find("Icon").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + spec.name + "Icon"); } } if (hasFinished) { confirmButText.text = LanController.getString("complete").ToUpper(); } else { confirmButText.text = LanController.getString("confirm").ToUpper(); } }
public void init(string fishId, float _maxCount) { spec = SpecController.getItemById(fishId) as FishItemSpec; maxCount = _maxCount; }
public TaskItemSpec getTaskSpec() { return(SpecController.getItemById(taskId) as TaskItemSpec); }
//Android //"jar:file://" + Application.dataPath void Start() { UI.gameObject.SetActive(false); if (Screen.width >= 800) { float t = Mathf.Max((float)Screen.width / 650, (float)Screen.height / 960); Camera.main.orthographicSize = 2.25f + t / 2 * 6f; } else { cannonCanvas.transform.localScale = new Vector3(0.01f * Screen.width / 800, 0.01f * Screen.width / 800, 1f); } if (!GameController.GetInstance().login) { SpecController.initGameXML(); LanController.ReadAndLoadXml(); //yield return StartCoroutine (initAssetsBundle ()); } if (!GameController.GetInstance().login) { //PlayerPrefs.DeleteAll (); loginCommand(); GameController.GetInstance().login = true; GameController.GetInstance().InitUnityPurchase(); } if (PlayerData.getGameuid() == null || PlayerData.getGameuid() == "") { creatNewPlayer(); GameController.GetInstance().isNewer = true; } Music = gameObject.GetComponent <AudioSource> (); Music.volume = PlayerData.getMusic(); cannonText = UI.transform.Find("Cannon").Find("Text").gameObject; bulletText = UI.transform.Find("Bullet").Find("Text").gameObject; cannonText.transform.GetComponent <Text> ().text = cannonLevel.ToString(); refreshBulletCount(); landText = UI.transform.Find("IslandTitle").Find("IslandText").GetComponent <Text>(); coinText = UI.transform.Find("IslandTitle").Find("CoinButton").Find("Text").GetComponent <Text>(); gemText = UI.transform.Find("IslandTitle").Find("GemButton").Find("Text").GetComponent <Text> (); taskButton = UI.transform.Find("TaskButton").gameObject; GameController.WorldBound = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0)); init(); if (PlayerData.getPets().Count <= 0) { creatPetBox(); if (GameController.GetInstance().curGuildStep == null) { DialogController.GetInstance().showGuiderPanel(GuilderPanel.Step01, UI.transform, Camera.main.WorldToScreenPoint(new Vector3(0, 0, 0))); } GameController.GetInstance().ContributionValue = 0.2f; } else { if (!PlayerData.hasTitle(GameController.TITLE01)) { DialogController.GetInstance().showTitlePanel(GameController.TITLE01); } } }
public SpecBuilder(SpecController controller) { Guard.NotNull(controller, nameof(controller)); _controller = controller; }