コード例 #1
0
        public void TryCreateFromDefault(MyPlayer.PlayerId newId, bool overwrite)
        {
            if (overwrite)
                MissionTriggers.Remove(newId);
            else
                if (MissionTriggers.ContainsKey(newId))
                    return;//already exists, thats ok for us
            MyMissionTriggers mtrig = new MyMissionTriggers();
            MissionTriggers.Add(newId, mtrig);

            MyMissionTriggers source;
            MissionTriggers.TryGetValue(new MyPlayer.PlayerId(0,0), out source);
            if (source == null)
                //older save which does not have defaults set
                return;
            mtrig.CopyTriggersFrom(source);
        }
コード例 #2
0
        public MyMissionTriggers TryCreateFromDefault(MyPlayer.PlayerId newId, bool overwrite = false)
        {
            MyMissionTriggers source;
            if (overwrite)
                MissionTriggers.Remove(newId);
            else
                if (MissionTriggers.TryGetValue(newId, out source))//(MissionTriggers.ContainsKey(newId))
                    return source;//already exists, thats ok for us
            MyMissionTriggers mtrig = new MyMissionTriggers();
            MissionTriggers.Add(newId, mtrig);

            MissionTriggers.TryGetValue(MyMissionTriggers.DefaultPlayerId, out source);
            if (source == null)
            {
                //older save which does not have defaults set
                source = new MyMissionTriggers();
                MySessionComponentMissionTriggers.Static.MissionTriggers.Add(MyMissionTriggers.DefaultPlayerId, source);
            }
            mtrig.CopyTriggersFrom(source);
            m_someoneWon = false;
            return mtrig;
        }