void OnChooseCard(int eventcode) { if (ChooseCardMode) { RequestMenu.ShowChooseShareCardMenu("Trade " + card.ToString() + " ?", card); return; } else if (eventcode == Role.OperationsExpert.GetHashCode()) { RequestMenu.ShowMenu("Discard " + card.ToString() + " and choose a city to move to" + " ?", Role.OperationsExpert.GetHashCode()); gameManager.OperationsExpertAbilityCard = (PlayerCard)correspongingCity.GetComponent <City>().cityNumber; return; } RequestMenu.ShowChooseCityCardMenu("Flight to " + card.ToString() + " ?", card); }
public void TreatDisease(PlayerCard city, int DiseaseType) { GameObject currentCity = GameObject.Find(city.ToString()); City script = currentCity.GetComponent <City>(); if (DiseaseType == 1) { int redDiseaseCount = script.getRedDisease(); if (redDiseaseCount > 0) { script.setRedDisease(); redDiseaseCount -= 1; string temp = currentCity.name + "Red"; GameObject diseaseCube = GameObject.Find(temp); diseaseCube.GetComponent <TextMeshProUGUI>().text = redDiseaseCount.ToString(); } } else if (DiseaseType == 2) { int blueDiseaseCount = script.getBlueDisease(); if (blueDiseaseCount > 0) { script.setBlueDisease(); blueDiseaseCount -= 1; string temp = currentCity.name + "Blue"; GameObject diseaseCube = GameObject.Find(temp); diseaseCube.GetComponent <TextMeshProUGUI>().text = blueDiseaseCount.ToString(); } } else if (DiseaseType == 3) { int yellowDiseaseCount = script.getYellowDisease(); if (yellowDiseaseCount > 0) { script.setYellowDisease(); yellowDiseaseCount -= 1; string temp = currentCity.name + "Yellow"; GameObject diseaseCube = GameObject.Find(temp); diseaseCube.GetComponent <TextMeshProUGUI>().text = yellowDiseaseCount.ToString(); } } else if (DiseaseType == 4) { int blackDiseaseCount = script.getBlackDisease(); if (blackDiseaseCount > 0) { script.setBlackDisease(); blackDiseaseCount -= 1; string temp = currentCity.name + "Black"; GameObject diseaseCube = GameObject.Find(temp); diseaseCube.GetComponent <TextMeshProUGUI>().text = blackDiseaseCount.ToString(); } } }
private void ResearchStationEvent(byte evCode, object content, int senderId) { Debug.LogError("ResearchStationEvent " + PhotonNetwork.player.ID); if (evCode != (byte)123) { return; } int cont = (int)content; PlayerCard card = (PlayerCard)cont; GameObject City = GameObject.Find(card.ToString()); City CurrentCity = City.GetComponent <City>(); CurrentCity.SetResearchStation(PlaceResearchStation(City, ResearchStation)); }
public void SelectCardCallBack(PlayerCard TradeCard) { if (OnShareKnowledge) { ShareKnowledge(1, TradeCard); OnShareKnowledge = false; hand.ChooseCardModeOff();// choose card to share return; } RaiseEventOptions opt = new RaiseEventOptions { Receivers = ReceiverGroup.All }; PhotonNetwork.RaiseEvent((byte)110, TradeCard.ToString(), true, opt); PhotonNetwork.RaiseEvent((byte)77, TradeCard.GetHashCode(), true, opt); ActionCallBack(); }
private void ShareKnowledgeEvent(byte evCode, object content, int senderId) { if (evCode != (byte)103) { return; } //int[] cont = content as int[]; byte[] cont = content as byte[]; shareKnowledgeRequestContent = new int[4]; for (int i = 0; i < 4; i++) { shareKnowledgeRequestContent[i] = cont[i]; } //string debug = ""; Debug.LogError("Player" + PhotonNetwork.player.ID + " store content in local"); string debug = ""; for (int i = 0; i < 4; i++) { debug += shareKnowledgeRequestContent[i].ToString() + " "; } Debug.Log("content is " + debug); //Debug.Log("in ShareKnoledge " + debug); if (cont[0] != PhotonNetwork.player.ID) { return; } PlayerCard tradecard = (PlayerCard)cont[2]; //int request = -1; //TODO get request // while (RequestMenu.GetRequest() == -1) ; string mesg = "You want to trade " + tradecard.ToString() + " with Player" + senderId + "?"; //RequestMenu.ShowMenu(mesg, cont[0], cont[1], cont[2], cont[3]); RequestMenu.ShowMenu(mesg, 1);//enent type 1 send request back }