public static void AddKill(this PhotonPlayer player, int num) { int current = player.GetKill(); current += num; Hashtable props = new Hashtable(); props[KillProp] = current; player.SetCustomProperties(props); // SetCustomProperties 会将多个 new Hashtable 转换为字符串键值对并封装在一起(player.CustomProperties) }
public static void AddKill(this PhotonPlayer player, int killToAddToCurrent) { int current = player.GetKill(); current = current + killToAddToCurrent; Hashtable hkill = new Hashtable(); // using PUN's implementation of Hashtable hkill[PlayerKill.PlayerKillProp] = current; player.SetCustomProperties(hkill); // this locally sets the score and will sync it in-game asap. }