コード例 #1
0
ファイル: CompArt.cs プロジェクト: potsh/RimWorld
 private void InitializeArt(Thing relatedThing, ArtGenerationContext source)
 {
     if (taleRef != null)
     {
         taleRef.ReferenceDestroyed();
         taleRef = null;
     }
     if (CanShowArt)
     {
         if (Current.ProgramState == ProgramState.Playing)
         {
             if (relatedThing != null)
             {
                 taleRef = Find.TaleManager.GetRandomTaleReferenceForArtConcerning(relatedThing);
             }
             else
             {
                 taleRef = Find.TaleManager.GetRandomTaleReferenceForArt(source);
             }
         }
         else
         {
             taleRef = TaleReference.Taleless;
         }
         titleInt = GenerateTitle();
     }
     else
     {
         titleInt = null;
         taleRef  = null;
     }
 }
コード例 #2
0
        private void InitializeArt(Thing relatedThing, ArtGenerationContext source)
        {
            if (taleRef != null)
            {
                //Is there any scenario where this should happen more than once?
                //Yes, theoretically. For example, we bury a corpse in a sarcophagus, then dig him up and bury another.
                //The art changes in response. But is this correct?
                taleRef.ReferenceDestroyed();
                taleRef = null;
            }

            if (CanShowArt)
            {
                if (Current.ProgramState == ProgramState.Playing)
                {
                    if (relatedThing != null)
                    {
                        taleRef = Find.TaleManager.GetRandomTaleReferenceForArtConcerning(relatedThing);
                    }
                    else
                    {
                        taleRef = Find.TaleManager.GetRandomTaleReferenceForArt(source);
                    }
                }
                else
                {
                    taleRef = TaleReference.Taleless;              //Todo add some chance of getting taleless art even in map play
                }
                titleInt = GenerateTitle();
            }
            else
            {
                titleInt = null;
                taleRef  = null;
            }
        }