using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityGameFramework.Runtime; public partial class GameMain : MonoBehaviour { float heartInterval = 60; public static bool beginHeart = false; void Start() { DontDestroyOnLoad(this); InitBuiltinComponents(); InitCustomComponents(); //广播事件样例 Log.Debug("广播GameMainComponentLoadDoneEvent事件"); Event.Fire(this,GameMainComponentLoadDoneEvent.Create()); } private void Update() { if (beginHeart) { heartInterval -= Time.deltaTime; if (heartInterval < 0) { heartInterval = 60; HttpGlobal.SendPingToServer(); } } } }