public void ToObject(string sentence, PlayerRegister reg) { string[] stage1 = sentence.Split(';'); string[] stage11 = stage1[0].Split(','); this.from_str = stage11[0]; this.from = reg.Lookup(stage11[0]); this.to = reg.Lookup(stage11[1]); this.to_str = stage11[1]; string[] stage12 = stage1[1].Split(','); for (int i = 0; i < stage12.Length; i++) { this.action.Add(stage12[i].Split(':')); } }
public string getRef(Player p) { var key = this.dictionary.FirstOrDefault(x => x.Value == p); return key.Key; }
public void Add(string key, Player val) { this.dictionary.Add(key, val); }
public void Send(string cardname, Player to) { to.onpass = take_handcard(cardname); this.handcard.Remove(to.onpass); this.passcardstatus = true; }
public bool Pass(Player to, Game g) { int passed = 0; for (int i = 0; i < g.playerName.Length; i++) { if (g.reg.Lookup(g.playerName[i]).passcardstatus) passed++; } if (passed == g.playerName.Length - 1) { return false; } if (this.last == to) { return false; } to.onpass = this.onpass; this.onpass = null; this.passcardstatus = true; return true; }
public void Claim(string cardname, Player to, Game g) { to.claim = cardname; to.last_str = g.reg.getRef(this); to.last = this; }