コード例 #1
0
 private static void SyncColor(SyncWorker sync, ref Color color)
 {
     sync.Bind(ref color.r);
     sync.Bind(ref color.g);
     sync.Bind(ref color.b);
     sync.Bind(ref color.a);
 }
コード例 #2
0
 //[SyncWorker(shouldConstruct = false)]
 public static void SyncKanbanSettings(SyncWorker sync, ref KanbanSettings ks)
 {
     sync.Bind(ref ks.srt);
     sync.Bind(ref ks.ssl);
     //if (sync.isWriting) {
     //    sync.Write(ks);
     //} else {
     //    ks = sync.Read<KanbanSettings>();
     //}
 }
コード例 #3
0
        static void ExtendedOutfitSyncer(SyncWorker sync, ref ExtendedOutfit outfit)
        {
            if (sync.isWriting)
            {
                sync.Bind(ref outfit.uniqueId);
            }
            else
            {
                int uid = 0;

                sync.Bind(ref uid);

                var currentOutfit = Current.Game.outfitDatabase.AllOutfits.Find(o => o.uniqueId == uid);
                if (currentOutfit is ExtendedOutfit extendedOutfit)
                {
                    outfit = extendedOutfit;
                }
            }
        }
コード例 #4
0
        private static void PawnHandlerSyncer(SyncWorker sync, ref PawnSavedPositionHandler inst)
        {
            var ownerPawn = inst?.Owner;

            sync.Bind(ref ownerPawn);
            if (!sync.isWriting && ownerPawn != null)
            {
                inst = DefensivePositionsManager.Instance.GetHandlerForPawn(ownerPawn);
            }
        }
コード例 #5
0
        // We only care about the research, no new nodes will be created or moved.
        static void HandleResearchNode(SyncWorker sw, ref ResearchNode node)
        {
            // Bind commands are in the order they are placed
            // So if you write a Def first, you must read it first and so on
            if (sw.isWriting)
            {
                // We are writing, node is the outgoing object
                sw.Bind(ref node.Research);
            }
            else
            {
                ResearchProjectDef research = null;

                sw.Bind(ref research);

                // We are reading, node is null, we must set it. So we look it up
                // research is unique in the Tree
                node = Lookup(research);
            }
        }
コード例 #6
0
ファイル: RitualData.cs プロジェクト: rwmt/Multiplayer
        public void Sync(SyncWorker sync)
        {
            sync.Bind(ref ritual);
            sync.Bind(ref target);
            sync.Bind(ref obligation);
            sync.Bind(ref outcome);
            sync.Bind(ref extraInfos);

            if (sync is WritingSyncWorker writer1)
            {
                WriteDelegate(writer1.writer, action);
            }
            else if (sync is ReadingSyncWorker reader)
            {
                action = (ActionCallback)ReadDelegate(reader.reader);
            }

            sync.Bind(ref ritualLabel);
            sync.Bind(ref confirmText);
            sync.Bind(ref organizer);

            if (sync is WritingSyncWorker writer2)
            {
                writer2.Bind(ref assignments, new SyncType(typeof(MpRitualAssignments))
                {
                    expose = true
                });
            }
            else if (sync is ReadingSyncWorker reader)
            {
                reader.Bind(ref assignments, new SyncType(typeof(MpRitualAssignments))
                {
                    expose = true
                });
            }
        }
コード例 #7
0
        static void StatPrioritySyncer(SyncWorker sync, ref StatPriority sp)
        {
            int     uid = selectedOutfitId;
            StatDef stat;

            if (sync.isWriting)
            {
                stat = sp.Stat;

                sync.Bind(ref uid);
                sync.Bind(ref stat);
                sync.Bind(ref sp.Weight);
            }
            else
            {
                stat = null;
                float weight = 0;

                sync.Bind(ref uid);
                sync.Bind(ref stat);
                sync.Bind(ref weight);

                var targetOutfit = Current.Game.outfitDatabase.AllOutfits.Find(o => o.uniqueId == uid);
                if (targetOutfit is ExtendedOutfit extendedOutfit)
                {
                    sp = extendedOutfit.StatPriorities.FirstOrDefault(o => o.Stat == stat);

                    if (sp != null)
                    {
                        sp.Weight = weight;
                    }
                    else
                    {
                        extendedOutfit.AddStatPriority(stat, weight);
                    }
                }
                else
                {
                    Log.Warning("Outfitted :: DESYNC INCOMING");
                }
            }
        }
コード例 #8
0
 public void Sync(SyncWorker sync)
 {
     sync.Bind(ref canUseDevMode);
     sync.Bind(ref godMode);
 }
コード例 #9
0
 //[SyncWorker(shouldConstruct = false)]
 public static void SyncKanbanSettings(SyncWorker sync, ref KanbanSettings ks)
 {
     sync.Bind(ref ks.srt);
     sync.Bind(ref ks.ssl);
 }