public void onClickTask() { TaskData data = PlayerData.getCurTask(); if (data != null) { DialogController.GetInstance().showTaskPanel(data); } else { taskButton.SetActive(false); } }
public void onClickOut() { AudioController.PlaySound(AudioController.SOUND_button); gameObject.SetActive(false); if (GameController.GetInstance().isNewer&& GameController.GetInstance().curGuildStep == GuilderPanel.Step03) { DialogController.GetInstance().showGuiderPanel(GuilderPanel.Step04, LoginController.GetInstance().UI.transform, LoginController.GetInstance().UI.transform.Find("WorldButton").transform.position); } if (GameController.GetInstance().CurrentScene == GameController.LOGINSCENE) { LoginController.GetInstance().initTreasure(); } }
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); } }
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 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(); }); }
public void onClickConfirm() { if (hasFinished) { foreach (string key in rewardList.Keys) { if (key == "gem") { PlayerData.setgem(PlayerData.getgem() + rewardList [key]); } else if (key == "coin") { PlayerData.setcoin(PlayerData.getcoin() + rewardList [key]); } else if (key == "bullet") { PlayerData.addBulletCount(rewardList [key]); } else if (key == "exp") { PlayerData.setFishExp(PlayerData.getFishExp() + rewardList [key]); } else if (key == "ship") { } else { PlayerData.addOwnedItem(key, rewardList [key]); } } GameController.GetInstance().finishTask(taskdata.taskId); if (PlayerData.getCurTask() != null) { DialogController.GetInstance().showTaskPanel(PlayerData.getCurTask()); } else { onClickOut(); } } else { onClickOut(); } }
private void OnChoiceSelected(Button button) { int index = choices.IndexOf(button); Debug.Log("Choice " + index + " selected"); DialogController dc = DialogController.GetInstance(); // If we're at the end then kill this screen if (dc.currNode.tags.Contains(Conversation.TAG_END)) { GameObject.Destroy(this.gameObject); dc.EndConversation(); return; } dc.SelectChoice(index); DisplayConversationNode(dc.currNode); }
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 DisplayConversationNode(ConversationNode node) { ConversationNode currNode = DialogController.GetInstance().currNode; if (!initialized) { return; } HideChoices(); // Load the correct image portraitImg.sprite = DialogController.GetInstance().GetPortraitSprite(currNode.spriteName); // Display the dialog text dialogText.text = currNode.displayBody; // If it's the last node then we can assume there's no choice to be made and // all that's necessary is a continue if (currNode.tags.Contains(Conversation.TAG_END)) { // If it's the end of the conversation or there are no choices continue; choices[0].gameObject.SetActive(true); choicesText[0].text = UIConstants.CONV_CONTINUE; return; } // Iterate through the choices and set up the choice buttons for (int i = 0; i < currNode.choices.Count; i++) { ConversationChoice choice = currNode.choices[i]; Button choiceBtn = choices[i]; // Re-enable it to make it visible. choiceBtn.gameObject.SetActive(true); Text choiceTxt = choicesText[i]; choiceTxt.text = i + ") " + choice.text; } }
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(); } }); }
public void onBuyConfirm() { AudioController.PlaySound(AudioController.SOUND_button); if (curBuyItemName == ExtendCannon) { int cost = PlayerData.getgem() - getExtendCannonCost(); if (cost >= 0) { PlayerData.setgem(cost); PlayerData.setPetCannonMaxCount(PlayerData.getPetCannonMaxCount() + 1); itemInfoPart.SetActive(false); refreshPetsList(); AudioController.PlaySound(AudioController.SOUND_Panel); } else { DialogController.GetInstance().showMessagePanel(LanController.getString("GemNotEnough")); } } else if (curBuyItemName == ExtendPet) { int cost = PlayerData.getcoin() - getExtendFishCost(); if (cost >= 0) { PlayerData.setcoin(cost); PlayerData.setPetMaxCount(PlayerData.getPetMaxCount() + 1); itemInfoPart.SetActive(false); refreshPetsList(); AudioController.PlaySound(AudioController.SOUND_Panel); } else { DialogController.GetInstance().showMessagePanel(LanController.getString("CoinNotEnough")); } } }
public void onShopClick() { DialogController.GetInstance().showShopPanel(); AudioController.PlaySound(AudioController.SOUND_button); }
public void onBuyButtonClicked(ItemSpec spec) { if (spec.getItemType() == SpecController.TreasureType) { GameController.GetInstance().BuyConsumable(spec.item_id); } else { if (spec.gem > 0) { if (PlayerData.getgem() < spec.gem) { //not enough DialogController.GetInstance().showMessagePanel(LanController.getString("GemNotEnough")); return; } else { PlayerData.setgem(PlayerData.getgem() - spec.gem); } } else { if (PlayerData.getcoin() < spec.coin) { //not enough DialogController.GetInstance().showMessagePanel(LanController.getString("CoinNotEnough")); return; } else { PlayerData.setcoin(PlayerData.getcoin() - spec.coin); } } initCoinAndGem(); if (spec.getItemType() == SpecController.BulletType) { PlayerData.addBullet(spec.item_id); } else if (spec.getItemType() == SpecController.CannonType) { PlayerData.addCannon(spec.item_id); } else if (spec.getItemType() == SpecController.BulletItemType) { PlayerData.addBulletCount(spec.count); if (GameController.GetInstance().CurrentScene == GameController.BATTLESCENE) { BattleController.GetInstance().refreshBulletCount(); } else if (GameController.GetInstance().CurrentScene == GameController.LOGINSCENE) { LoginController.GetInstance().refreshBulletCount(); } } } initCoinAndGem(); refreshItemList(); AudioController.PlaySound(AudioController.SOUND_FULLSKILL); }
public void onLevelUpClicked() { AudioController.PlaySound(AudioController.SOUND_button); DialogController.GetInstance().showLevelUpPanel(curPetData); onClickOut(); }
public void onInfoBuyClicked() { AudioController.PlaySound(AudioController.SOUND_button); if (itemType == TYPE_SPEED) { int cost = (curPetData.getLeftTime().Hours + 1); if (PlayerData.getgem() < cost) { DialogController.GetInstance().showMessagePanel(LanController.getString("GemNotEnough")); } else { PlayerData.setgem(PlayerData.getgem() - cost); curPetData.speedup(); PlayerData.updatePetEgg(curPetData); } } else if (itemType == TYPE_BUY) { if (spec.gem > 0) { if (PlayerData.getgem() < spec.gem) { DialogController.GetInstance().showMessagePanel(LanController.getString("GemNotEnough")); } else { PlayerData.setgem(PlayerData.getgem() - spec.gem); PlayerData.addOwnedItem(spec.item_id, 1); } } else { if (PlayerData.getcoin() < spec.coin) { DialogController.GetInstance().showMessagePanel(LanController.getString("CoinNotEnough")); } else { PlayerData.setcoin(PlayerData.getcoin() - spec.coin); PlayerData.addOwnedItem(spec.item_id, 1); } } } else if (itemType == TYPE_Extend) { if (PlayerData.getcoin() < getExtendCost()) { DialogController.GetInstance().showMessagePanel(LanController.getString("CoinNotEnough")); } else { PlayerData.setcoin(PlayerData.getcoin() - getExtendCost()); PlayerData.setPetEggMaxCount(maxEggsCount + 1); } } itemInfoPart.SetActive(false); initFishData(curIndex); }
public void onConfirmClicked() { AudioController.PlaySound(AudioController.SOUND_button); if (itemType == TYPE_BUY) { itemInfoPart.SetActive(true); itemInfoPart.transform.Find("ItemImage").GetComponent <Image> ().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + spec.name + "Icon"); int cost = 10000; GameObject buyButImg = itemInfoPart.transform.Find("BuyButton").gameObject; if (spec.gem > 0) { cost = spec.gem; buyButImg.transform.Find("Image").GetComponent <Image> ().sprite = GameController.GetInstance().getSpByName("Pic/ui/gemIcon"); } else { cost = spec.coin; buyButImg.transform.Find("Image").GetComponent <Image> ().sprite = GameController.GetInstance().getSpByName("Pic/ui/CoinIcon"); } itemInfoPart.transform.Find("message").GetComponent <Text> ().text = spec.getMessage(); buyButImg.transform.Find("Text").GetComponent <Text> ().text = cost.ToString(); itemInfoPart.transform.Find("NameText").gameObject.GetComponent <Text> ().text = LanController.getString(spec.name).ToUpper(); } else if (itemType == TYPE_USE) { if (curEggsCount < maxEggsCount) { PlayerData.addOwnedItem(spec.item_id, -1); PlayerData.addPetEgg(creatNewEgg()); initFishData(curIndex); } else { showExtendPet(); DialogController.GetInstance().showMessagePanel(LanController.getString("PetEggFull")); } } else if (itemType == TYPE_OUT) { PlayerData.deletePetEgg(curPetData); PetData data = new PetData(); data.initId(PlayerData.creatPetId(), curPetData.item_id); PlayerData.addPet(data); LoginController.GetInstance().creatNewPet(data); onClickOut(); } else if (itemType == TYPE_SPEED) { itemInfoPart.SetActive(true); itemInfoPart.transform.Find("ItemImage").GetComponent <Image> ().sprite = GameController.GetInstance().getSpByName("Pic/ui/" + spec.name + "Icon"); int cost = (curPetData.getLeftTime().Hours + 1); 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("speedEggMes"); buyButImg.transform.Find("Text").GetComponent <Text> ().text = cost.ToString(); itemInfoPart.transform.Find("NameText").gameObject.GetComponent <Text> ().text = LanController.getString("speedup").ToUpper(); } }
public void onClick() { DialogController.GetInstance().showMissionFishPanel(fishData); }
public void onClickInfo() { DialogController.GetInstance().showFishInfoPanel(data_id); gameObject.SetActive(false); }
public void Click() { DialogController.GetInstance().showPetToggle(_petData.data_id, Camera.main.WorldToScreenPoint(transform.position)); }
public void onClickSetting() { DialogController.GetInstance().showSettingPanel(); AudioController.PlaySound(AudioController.SOUND_button); }
void OnMouseDown() { //DialogController.GetInstance ().showWorldFishPanel (fishData); DialogController.GetInstance().showMessagePanel(LanController.getString("comingsoon")); }
//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 void onClickHome() { DialogController.GetInstance().showBattleResult(); AudioController.PlaySound(AudioController.SOUND_button); }
public void onFishbuttonClick() { DialogController.GetInstance().showFishEggsInfoPanel(); AudioController.PlaySound(AudioController.SOUND_button); }