コード例 #1
0
        private void OnGlobalFlag(ref MyEventGlobalFlag msg)
        {
            switch(msg.Flag)
            {
                case MyGlobalFlagsEnum.REGENERATE_WAYPOINTS:
                    MyScriptWrapper.RegenerateWaypointGraph();
                    break;

                case MyGlobalFlagsEnum.REQUEST_INFO:
                    if(MySession.Static != null && MySession.Static.Player.Faction != MyMwcObjectBuilder_FactionEnum.None)
                    {
                        SendFaction(MySession.Static.Player.Faction);
                        UpdateStats();
                    }
                    break;

                default:
                    Alert("Unknown global flag", msg.SenderEndpoint, msg.EventType);
                    break;
            }
        }
コード例 #2
0
        public void SendGlobalFlag(MyGlobalFlagsEnum eventFlag)
        {
            var msg = new MyEventGlobalFlag();
            msg.Flag = eventFlag;

            Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableOrdered);
        }