public static void SendHpChg(Character sender, int chgHPGID, int hp, HPChgType chgType) { if (sender.Type != CharacterType.Player) { return; } Player player = sender as Player; NotifyHPChg msg = new NotifyHPChg(); msg.hp = hp; msg.chgType = chgType; msg.uid = chgHPGID; NetWork.NotifyMessage <NotifyHPChg>(player.UserID, STC.STC_HPChg, msg); }
static void OnChgHp(byte[] data) { Scene scn = SceneSystem.Instance.mCurrentScene; if (scn == null) { return; } NotifyHPChg msg = ProtoBufUtils.Deserialize <NotifyHPChg>(data); Character cha = scn.GetCharacter(msg.uid); if (cha == null) { return; } HPChgType hurtType = (HPChgType)msg.chgType; cha.headBar.CreateHeadText(hurtType, msg.hp); }