// 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; } }
public void init(string title = "Title01") { transform.Find("TitleEffect").GetComponent <Image>().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + title + "Icon"); transform.Find("Name").GetComponent <Text>().text = LanController.getString(title).ToUpper(); transform.Find("MessageText").GetComponent <Text> ().text = LanController.getString("inputTextMessage"); }
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(); } } }
void refreshMissionPart() { if ((System.DateTime.Now - startTime).Seconds >= 0) { TimeSpan span = missionTotleTime - (System.DateTime.Now - startTime); if (span.TotalSeconds >= 0) { missionPart.transform.Find("Time").GetComponent <Text> ().text = new TimeSpan(0, 0, (int)span.TotalSeconds).ToString(); missionPart.transform.Find("Count").GetComponent <Text> ().text = fishEntityList.Count.ToString(); if (fishEntityList.Count <= 0 && fishList.Count <= 0) { //success battleOver = true; finishMission(); } } else { //timeout battleOver = true; DialogController.GetInstance().showMessagePanel(LanController.getString("MissionTimeOut"), true, delegate { GameController.GetInstance().OpenWorldScene(); }, delegate { GameController.GetInstance().OpenWorldScene(); }); endFishing(); } } }
public void beClickHandle() { gameObject.SetActive(false); switch (curStep) { case GuilderPanel.Step01: GameController.GetInstance().addPet(GameController.initPetId); LoginController.GetInstance().removeBox(); DialogController.GetInstance().showFishInfoPanel(); DialogController.GetInstance().showMessagePanel(LanController.getString("remindTofight")); break; case GuilderPanel.Step02: DialogController.GetInstance().showTaskPanel(PlayerData.getCurTask()); break; case GuilderPanel.Step03: DialogController.GetInstance().showFishEggsInfoPanel(); break; case GuilderPanel.Step04: LoginController.GetInstance().onClickFight(); break; } }
// Use this for initialization void Awake() { init(); initSea(); initBullet(); initCannon(); CatchedIcon = GameController.GetInstance().getPrefab("CatchedFish"); initPet(); beginNextWave(); if (BattleMode == BattleFormation.MissionMode) { missionPart.transform.Find("Title").GetComponent <Text> ().text = LanController.getString("MissionFish"); missionTotleTime = new TimeSpan(0, 0, missionData.wholeTime); startTime = System.DateTime.Now; missionPart.transform.Find("TCount").GetComponent <Text> ().text = "/" + fishList.Count.ToString(); refreshMissionPart(); } else { checkTask(); } beginTreasure = PlayerData.getcoin() + PlayerData.getBulletCount(); if (GameController.GetInstance().isNewer&& GameController.GetInstance().curGuildStep == GuilderPanel.Step04) { DialogController.GetInstance().showGuiderPanel(GuilderPanel.Step05, UI.transform, UI.transform.Find("HomeButton").transform.position); } }
public void onFishButClick(GameObject fishRender) { AudioController.PlaySound(AudioController.SOUND_button); if (fishRender.name == ExtendPet) { showItemBuyPart(ExtendPet); } else { if (leftCannonBaseCount > 0) { int selectId = int.Parse(fishRender.name); foreach (PetData pData in list) { if (pData.data_id == selectId) { if (pData.currentState == GameController.Pet_Default) { pData.currentState = GameController.Pet_Fight; } refreshPetsList(); break; } } } else { DialogController.GetInstance().showMessagePanel(LanController.getString("NotMoreBase")); } } }
void showItemBuyPart(string itemName) { curBuyItemName = itemName; if (itemName == ExtendCannon) { itemInfoPart.SetActive(true); itemInfoPart.transform.Find("ItemImage").GetComponent <Image> ().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + "LockIcon"); int cost = getExtendCannonCost(); GameObject buyButImg = itemInfoPart.transform.Find("BuyButton").gameObject; buyButImg.transform.Find("Image").GetComponent <Image> ().sprite = GameController.GetInstance().getSpByName("Pic/ui/gemIcon"); itemInfoPart.transform.Find("message").GetComponent <Text> ().text = LanController.getString("addOneCannon"); buyButImg.transform.Find("Text").GetComponent <Text> ().text = cost.ToString(); itemInfoPart.transform.Find("NameText").gameObject.GetComponent <Text> ().text = LanController.getString("petCannon").ToUpper(); } else { itemInfoPart.SetActive(true); itemInfoPart.transform.Find("ItemImage").GetComponent <Image> ().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + "TipIcon04"); int cost = getExtendFishCost(); GameObject buyButImg = itemInfoPart.transform.Find("BuyButton").gameObject; buyButImg.transform.Find("Image").GetComponent <Image> ().sprite = GameController.GetInstance().getSpByName("Pic/ui/CoinIcon"); itemInfoPart.transform.Find("message").GetComponent <Text> ().text = LanController.getString("addOneFish"); buyButImg.transform.Find("Text").GetComponent <Text> ().text = cost.ToString(); itemInfoPart.transform.Find("NameText").gameObject.GetComponent <Text> ().text = LanController.getString("petFish").ToUpper(); } }
public void onInfoConfirm() { AudioController.PlaySound(AudioController.SOUND_button); foreach (PetData pData in list) { if (pData.data_id == curPetData.data_id) { if (pData.currentState == GameController.Pet_Default) { if (leftCannonBaseCount > 0) { pData.currentState = GameController.Pet_Fight; } else { DialogController.GetInstance().showMessagePanel(LanController.getString("NotMoreBase")); } } else { pData.currentState = GameController.Pet_Default; } refreshPetsList(); break; } } infoPart.gameObject.SetActive(false); }
void BuyProductID(string productId) { if (IsPaymentInitialized()) { Product product = m_StoreController.products.WithID(productId); // If the look up found a product for this device's store and that product is ready to be sold ... if (product != null && product.availableToPurchase) { Debug.Log(string.Format("Purchasing product asychronously: '{0}'", product.definition.id)); m_StoreController.InitiatePurchase(product); } // Otherwise ... else { // ... report the product look-up failure situation Debug.Log("BuyProductID: FAIL. Not purchasing product, either is not found or is not available for purchase"); DialogController.GetInstance().showMessagePanel(LanController.getString("paymentError03")); } } // Otherwise ... else { // ... report the fact Purchasing has not succeeded initializing yet. Consider waiting longer or // retrying initiailization. Debug.Log("BuyProductID FAIL. Not initialized."); DialogController.GetInstance().showMessagePanel(LanController.getString("paymentError01")); InitUnityPurchase(); } }
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(); }
public void onIslandSelected(GameObject island) { //scaleSlider.value = 0; moveWorld(-island.GetComponent <RectTransform> ().anchoredPosition + (Vector2)Camera.main.transform.position); if (island.name == "NoviceIsland") { if (PlayerData.getMyShipData() == null) { DialogController.GetInstance().showMessagePanel(LanController.getString("beginShipTask"), true, delegate { TaskData data = PlayerData.getCurTask(); if (data == null || data.taskId == "random") { DialogController.GetInstance().showTaskPanel(GameController.GetInstance().addTask("70001")); } else { DialogController.GetInstance().showTaskPanel(data); } }); } else { DialogController.GetInstance().showIslandPanel(island.transform.name); } } else { DialogController.GetInstance().showMessagePanel(LanController.getString("comingsoon")); } AudioController.PlaySound(AudioController.SOUND_button); }
IEnumerator command(string phpUrl, WWWForm form) { WWW www = new WWW(phpUrl, form); while (!www.isDone) { Debug.Log("wait..."); } yield return(www); if (www.error != null) { Debug.LogError(www.error); } else { AmfObject jsonData = JsonMapper.ToObject <AmfObject> (www.text); PlayerData.setGameuid(jsonData.gameuid); if (jsonData.compensate != null) { List <OwnedItem> list = JsonMapper.ToObject <List <OwnedItem> > (jsonData.compensate); DialogController.GetInstance().showRewardsPanel(list, LanController.getString("compensate")); } GameController.GetInstance().setSystemTime(jsonData.__end_time); GameController.GetInstance().personCheck(); checkTask(); } }
// Use this for initialization void Start() { transform.Find("TitleText").GetComponent <Text> ().text = LanController.getString("Congratulations").ToUpper(); transform.Find("ConfirmButton").Find("Text").GetComponent <Text> ().text = LanController.getString("confirm").ToUpper(); inputText = transform.Find("InputField").GetComponent <InputField> (); transform.Find("InputField").Find("Placeholder").GetComponent <Text> ().text = LanController.getString("inputTextPlace"); }
public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason) { // A product purchase attempt did not succeed. Check failureReason for more detail. Consider sharing // this reason with the user to guide their troubleshooting actions. Debug.Log(string.Format("OnPurchaseFailed: FAIL. Product: '{0}', PurchaseFailureReason: {1}", product.definition.storeSpecificId, failureReason)); DialogController.GetInstance().showMessagePanel(LanController.getString("paymentError02")); }
public string getMessage() { if (message != null && message != "") { return(LanController.getString(message)); } else { return(""); } }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } //DontDestroyOnLoad(this); }
// 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 initPet(PetData data) { curData = data; newData = data.getNextLevelData(); transform.Find("TitleText").GetComponent <Text> ().text = LanController.getString("levelUpPET").ToUpper(); transform.Find("FishButton").GetComponent <FishInfoTip> ().init(curData); transform.Find("NewFishButton").GetComponent <FishInfoTip> ().init(newData); transform.Find("CoinButton").Find("Text").GetComponent <Text> ().text = LanController.getString("confirm").ToUpper(); transform.Find("TipText").GetComponent <Text> ().text = LanController.getString("PetLevelUpTip"); transform.Find("CoinText").GetComponent <Text> ().text = curData.getLevelCost().ToString(); transform.Find("ExpText").GetComponent <Text> ().text = curData.getUpgradeExp().ToString(); }
// 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)); }
public void ClickConfirm() { Debug.Log(inputText.text); if (inputText.text == "" || inputText.text == null) { DialogController.GetInstance().showMessagePanel(LanController.getString("inputTextMessage")); } else { setNameCommand(inputText.text); PlayerData.setPlayerName(inputText.text); PlayerData.addTitle(GameController.TITLE01); } }
void showExtendPet() { itemType = TYPE_Extend; itemInfoPart.SetActive(true); itemInfoPart.transform.Find("ItemImage").GetComponent <Image> ().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + "HomeIcon08"); GameObject buyButImg = itemInfoPart.transform.Find("BuyButton").gameObject; buyButImg.transform.Find("Image").GetComponent <Image> ().sprite = GameController.GetInstance().getSpByName("Pic/ui/CoinIcon"); itemInfoPart.transform.Find("message").GetComponent <Text> ().text = LanController.getString("extendPetEgg"); buyButImg.transform.Find("Text").GetComponent <Text> ().text = getExtendCost().ToString(); itemInfoPart.transform.Find("NameText").gameObject.GetComponent <Text> ().text = LanController.getString("capacity").ToUpper(); }
void finishMission() { List <OwnedItem> rewards = new List <OwnedItem> (); if (missionData.fishLevel == 3) { OwnedItem item0 = new OwnedItem(); item0.item_id = "gem"; item0.count = 2; rewards.Add(item0); } OwnedItem item = new OwnedItem(); item.item_id = "coin"; item.count = getCatchFishCoin() * 2; rewards.Add(item); OwnedItem item1 = new OwnedItem(); item1.item_id = "exp"; item1.count = getPetCatchExp(); rewards.Add(item1); OwnedItem item2 = new OwnedItem(); item2.item_id = "bullet"; item2.count = missionData.fishLevel * 500; rewards.Add(item2); MissionFishData newMissionData = GameController.GetInstance().creatMissionFish(missionData.fishLevel, Mathf.Max(missionData.getEndTime(), GameController.GetInstance().getCurrentSystemNum())); HomeObject curObject = PlayerData.getHomeObject(PlayerData.getGameuid()); foreach (MissionFishData mData in curObject.missionFishes) { if (mData.item_id == missionData.item_id) { curObject.missionFishes.Remove(mData); break; } } curObject.missionFishes.Add(newMissionData); PlayerData.updateHomeObject(curObject); DialogController.GetInstance().showRewardsPanel(rewards, LanController.getString("MissionRewards"), delegate { GameController.GetInstance().OpenWorldScene(); }); }
IEnumerator command(string phpUrl, WWWForm form) { WWW www = new WWW(phpUrl, form); while (!www.isDone) { //Debug.Log ("wait..."); } yield return(www); if (www.error != null) { Debug.LogError(www.error); DialogController.GetInstance().showMessagePanel(LanController.getString("paymentError02")); } else { Debug.Log(www.text); AmfObject jsonData = JsonMapper.ToObject <AmfObject> (www.text); Debug.Log("test" + jsonData.productId); if (jsonData.status == "ok") { switch (jsonData.productId) { case GameController.littleCoins: PlayerData.setcoin(PlayerData.getcoin() + 10000); break; case GameController.largeCoins: PlayerData.setcoin(PlayerData.getcoin() + 66666); break; case GameController.littleGems: PlayerData.setgem(PlayerData.getgem() + 100); break; case GameController.largeGems: PlayerData.setgem(PlayerData.getgem() + 1500); break; } } if (GameController.GetInstance().CurrentScene == GameController.LOGINSCENE) { LoginController.GetInstance().initTreasure(); } DialogController.GetInstance().showMessagePanel(LanController.getString("paymentSuc")); } }
void configPos() { //Vector3 position =new Vector3(230,380,0); string message = LanController.getString("guild" + curStep); float s = 1280f / Screen.height; Center.transform.position = new Vector2(position.x, position.y); // Center.rectTransform.sizeDelta = new Vector2 (Center.rectTransform.sizeDelta.x*s,Center.rectTransform.sizeDelta.y* s); Vector2 centerBund = new Vector2(Center.rectTransform.sizeDelta.x, Center.rectTransform.sizeDelta.y); Top.rectTransform.sizeDelta = new Vector2(Screen.width * s, Screen.height * s - (centerBund.y / 2) - position.y * s); Top.transform.position = new Vector3(Screen.width / 2, position.y + centerBund.y / 2 / s, 0); Bottom.rectTransform.sizeDelta = new Vector2(Screen.width * s, position.y * s - (centerBund.y / 2)); Bottom.transform.position = new Vector3(Screen.width / 2, position.y - centerBund.y / 2 / s, 0); Left.rectTransform.sizeDelta = new Vector2(position.x * s - (centerBund.x / 2), centerBund.y); Left.transform.position = new Vector3(position.x - (centerBund.x / 2 / s), position.y); Right.rectTransform.sizeDelta = new Vector2(Screen.width * s - (centerBund.x / 2) - position.x * s, centerBund.y); Right.transform.position = new Vector3(position.x + (centerBund.x / 2 / s), position.y, 0); if (position.x > Screen.width / 2) { Arrow.transform.position = new Vector2(position.x - centerBund.x / 2 / s, position.y); Arrow.transform.localScale = new Vector3(-1, 1, 1); } else { Arrow.transform.position = new Vector2(position.x + centerBund.x / 2 / s, position.y); } if (message == null) { MessagePart.SetActive(false); } else { MessagePart.GetComponent <RectTransform> ().position = new Vector3(Screen.width / 2, Screen.height * 4 / 5, 0); MessagePart.transform.Find("Text").GetComponent <Text> ().text = message; } }
void Awake() { fishList = transform.Find("FishList").gameObject; listItemRender = fishList.transform.Find("FishRender").gameObject; coinPart = transform.Find("CoinButton"); listGrid = fishList.transform.Find("Grid").gameObject; notText = transform.Find("NotText").gameObject; notText.GetComponent <Text> ().text = LanController.getString("notFish"); finishBut = transform.Find("FinishButton").gameObject; finishBut.transform.Find("Text").GetComponent <Text> ().text = LanController.getString("exit").ToUpper(); transform.Find("TitleText").GetComponent <Text> ().text = LanController.getString("rewards").ToUpper(); petExpText = transform.Find("PetCanvas").Find("Text").GetComponent <Text> (); coins = 0; }
public void ClickConfirm() { if (PlayerData.getcoin() < curData.getLevelCost()) { DialogController.GetInstance().showMessagePanel(LanController.getString("CoinNotEnough")); } else if (PlayerData.getFishExp() < curData.getUpgradeExp()) { DialogController.GetInstance().showMessagePanel(LanController.getString("ExpNotEnough")); } else { PlayerData.setcoin(PlayerData.getcoin() - curData.getLevelCost()); PlayerData.setFishExp(PlayerData.getFishExp() - curData.getUpgradeExp()); curData.level++; PlayerData.updatePetData(curData); AudioController.PlaySound(AudioController.SOUND_FULLSKILL); } ClickOut(); }
public void onClick() { List <OwnedItem> list = new List <OwnedItem> (); OwnedItem item = new OwnedItem(); item.item_id = "bullet"; item.count = 100; list.Add(item); OwnedItem item1 = new OwnedItem(); item1.item_id = "coin"; item1.count = 100; list.Add(item1); DialogController.GetInstance().showRewardsPanel(list, LanController.getString("HelpReward")); Destroy(gameObject); GameController.GetInstance().creatTrappedFish(hObject, GameController.GetInstance().getCurrentSystemNum() + 3600 * 4); }
public void fire() { int bulletcount = PlayerData.getBulletCount(); if (bulletcount <= 0) { //goumai DialogController.GetInstance().showShopPanel(ShopPanel.BulletItemTab); DialogController.GetInstance().showMessagePanel(LanController.getString("BulletNotEnough")); } else { if (cannonLevel > bulletcount) { cannonLevel = bulletcount; cannonText.GetComponent <Text> ().text = cannonLevel.ToString(); } Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector3 curPos = curCannon.transform.Find("Cannon").position; mousePos = new Vector3(mousePos.x, mousePos.y, curPos.z); Vector3 v = (mousePos - curPos).normalized; float tar = Mathf.Atan2(v.y, v.x) * Mathf.Rad2Deg - 90; creatBullet(curPos, v, null); curCannon.GetComponent <MyCannon> ().shot(tar); int otherBullets = bulletcount - cannonLevel; PlayerData.setBulletCount(otherBullets); refreshBulletCount(); AudioController.PlaySound(AudioController.SOUND_GUN); foreach (GameObject fishCannon in fishCannonList) { fishCannon.GetComponent <FishCannon> ().fire(mousePos); } } }
public void onReleaseClicked() { AudioController.PlaySound(AudioController.SOUND_button); PetData data = curPetData; DialogController.GetInstance().showMessagePanel(LanController.getString("Suretorelease"), true, delegate { if (data != null) { List <OwnedItem> l = new List <OwnedItem>(); OwnedItem cItem = new OwnedItem(); cItem.item_id = "coin"; cItem.count = (int)((data.level + 1) * 1000 * Random.Range(0.5f, 1.5f)); l.Add(cItem); OwnedItem eItem = new OwnedItem(); eItem.item_id = "exp"; eItem.count = (int)((data.level + 1) * 100 * Random.Range(0.5f, 1f)); l.Add(eItem); DialogController.GetInstance().showRewardsPanel(l, LanController.getString("conRewards")); foreach (PetData d in list) { if (data.data_id == d.data_id) { list.Remove(d); break; } } onClickOut(); } }); }