private List <CupGYJMatchInfo> Get_OZB_GYJMatchList(CupInfo worldCupInfo) { var list = new List <CupGYJMatchInfo>(); //foreach (var item in worldCupInfo) //{ var GYJmatch = worldCupInfo.data; var GYJarray = GYJmatch.Split('|');//.ToArray(); foreach (var arr in GYJarray) { var arrlist = arr.Split('-'); list.Add(new CupGYJMatchInfo { MatchId = arrlist[0].PadLeft(2, '0'), Team = arrlist[1].ToString(), BetState = arrlist[2].ToString(), BonusMoney = decimal.Parse(arrlist[3]), SupportRate = decimal.Parse(arrlist[4].Replace("%", "").ToString()), Probadbility = decimal.Parse(arrlist[5].Replace("%", "").ToString()), IssuseNumber = DateTime.Now.Year.ToString(), GameType = "GYJ", GameCode = "OZB", }); } //} return(list); }
public bool Equals(CupInfo c) { // If parameter is null, return false. if (Object.ReferenceEquals(c, null)) { return(false); } // Optimization for a common success case. if (Object.ReferenceEquals(this, c)) { return(true); } // If run-time types are not exactly the same, return false. if (this.GetType() != c.GetType()) { return(false); } // Return true if the fields match. // Note that the base class is not invoked because it is // System.Object, which defines Equals as reference equality. return(id == c.id); }
private void OnClick() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000)) { Debug.Log($"CLICKED ON: {hit.transform.gameObject.name}"); CupInfo cup = hit.transform.gameObject.GetComponent <CupInfo>(); //If the gameobject has a cupInfo component if (cup) { if (authorities[(int)Actions.Place]) { cup.OnClick(this); } else { Debug.Log("Not your turn to place a pill"); } } else { if (authorities[(int)Actions.Reveal]) { } else { Debug.Log("not your turn to reveal"); } } } }
public void AddCup(CupInfo cup) { if (cup == null) { Debug.LogError("null parameter in AddCup"); return; } cupInfos.Add(cup.id, cup); RepositionCups(); }
///<summary> Sets the size of all UI elements. </summary> ///<param name="scaleVector"> The Local Scale that all UI Elements should be set to </param> private void SetUISize(CupInfo cupInfo, Vector3 scaleVector) { UI_pillDisplay = UIManager.instance.pillDisplays[cupInfo.id - 1]; // Sets the Correct Cup Display based on CupInfo IMG_playerSprite.rectTransform.localScale = scaleVector; // Sets the Player Sprite's Scale TMP_playerName.rectTransform.localScale = scaleVector; // Sets the Player Name's Scale TMP_resultHeader.rectTransform.localScale = scaleVector; // Sets the Result Header's Scale TMP_pillHeader.rectTransform.localScale = scaleVector; // Sets the Pill Header's Scale TMP_playerState.rectTransform.localScale = scaleVector; // Sets the Player State's Scale TMP_points.rectTransform.localScale = scaleVector; // Sets the Point's Scale UI_pillDisplay.transform.position = scaleVector; // Sets tge Pill Display's Scale }
public void RemoveCup(CupInfo cup) { if (cup == null) { Debug.LogError("null parameter in RemoveCup"); return; } cupInfos.Remove(cup.id); Destroy(cup.transform.gameObject); RepositionCups(); }
public static void PlacePill(Pill _pill, CupInfo _cup) { Debug.Log("Send placepill packet"); using (Packet _packet = new Packet((int)ClientPackets.placePill)) { //Debug.Log($"Pill Colors: Pill: {_pill.pillColor}, Player {_pill.playerColor} "); _packet.Write(Client.instance.myId); _packet.Write(UIManager.instance.usernameField.text); _packet.Write(_cup.id); _packet.Write(_pill); SendTCPData(_packet); } }
///<summary> Begins the Animation for Results Reveal </summary> ///<param name="cupInfo"> The CupInfo for the corresponding Player </param> public IEnumerator cutscene(CupInfo cupInfo) { SetUISize(cupInfo, Vector3.zero); // Sets the Scale of All Relevant UI Elements to Zero FormatUI(cupInfo); // Formats the UI to the details within the CupInfo // Animation Beat 1: Spawns PlayerSprite, PlayerName, ResultsHeader and PillHeader LeanTween.scale(IMG_playerSprite.gameObject, Vector3.one, 0.5f).setEase(tweenType); LeanTween.scale(TMP_playerName.gameObject, Vector3.one, 0.5f).setEase(tweenType); LeanTween.scale(TMP_resultHeader.gameObject, Vector3.one, 0.5f).setEase(tweenType); LeanTween.scale(TMP_pillHeader.gameObject, Vector3.one, 0.5f).setEase(tweenType); yield return(new WaitForSeconds(1f)); // Waits 1 Second between Animation Beats LeanTween.scale(UI_pillDisplay.gameObject, Vector3.one, 0.5f).setEase(tweenType); // Animation Beat 2: Spawns PillDisplay yield return(new WaitForSeconds(1f)); // Waits 1 Second between Animation Beats // Animation Beat 3: Spawns a Skull for each Poison Pill for (int i = 0; i < UI_pillDisplay.list_pills.Count; i++) { if (UI_pillDisplay.list_pills[i].GetComponent <PillRenderer>().pill.poison == true) { GameObject temp_marker = Instantiate(skull, UI_pillDisplay.list_pills[i].transform.position + (Vector3.up * 2), Quaternion.identity); temp_marker.GetComponent <RectTransform>().localScale = Vector3.zero; LeanTween.scale(temp_marker, Vector3.one, 0.25f).setEase(tweenType); } yield return(new WaitForSeconds(0.25f)); } yield return(new WaitForSeconds(1f)); // Waits 1 Second Between Animation beats // Set Dead State and Points (ASK EVAN FOR CALCULATING DEAD STATE AND POINTS) // Animation Beat 4: Spawns DeadState and Points LeanTween.scale(TMP_playerState.gameObject, Vector3.one, 0.5f).setEase(tweenType); LeanTween.scale(TMP_points.gameObject, Vector3.one, 0.5f).setEase(tweenType); // ASK EVAN HOW WE SHOULD TRIGGER THE NEXT CUTSCENE //Some Trigger // cutscene(); }
private void MouseRaycast() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000)) { Debug.Log($"HOVERING: {hit.transform.gameObject.name}"); CupInfo newCup = hit.transform.gameObject.GetComponent <CupInfo>(); //If the gameobject has a cupInfo component if (newCup) { if (oldCup != newCup) { newCup.OffHover(); } oldCup = newCup; newCup.OnHover(); } } }
private void CreateCup(CursorManager cm) { GameObject g = Instantiate(testCup); // // This Part does not do anything // Debug.Log("Before: " + g.GetComponent<Renderer>().materials[0].color); // g.GetComponent<Renderer>().materials[0].color = cm.cursorColor; // Debug.Log("After: " + g.GetComponent<Renderer>().materials[0].color); // This part Sets the Entire Mesh to be one Color var block = new MaterialPropertyBlock(); block.SetColor("_BaseColor", cm.cursorColor); g.GetComponent <Renderer>().SetPropertyBlock(block); CupInfo c = g.GetComponent <CupInfo>(); if (c) { c.Initialize(cm.id, cm.name, cm.cursorColor); c.color = cm.cursorColor; } GameManager.instance.AddCup(c); }
///<summary> Format all UI elements in accordance to the details within the CupInfo </summary> ///<param name="cupInfo"> The CupInfo for the corresponding Player </param> private void FormatUI(CupInfo cupInfo) { IMG_playerSprite.color = cupInfo.color; // Sets the Player Sprite to the Correct Color TMP_playerName.text = cupInfo.username; // Sets the PlayerName to the Correct Username UI_pillDisplay.GetComponent <RectTransform>().position = TMP_pillHeader.rectTransform.position - (Vector3.down * 4); // Sets the PillHeaders Local Position }