コード例 #1
0
 public void UpdateItemInCurrentRecording(SpeakerItem oOldValue, SpeakerItem oNewVal)
 {
     for (int iPtr = 0; iPtr < CurrentRecording.Count; iPtr++)
     {
         if (CurrentRecording[iPtr].Equals(oOldValue))
         {
             CurrentRecording[iPtr] = oNewVal;
             break;
         }
     }
 }
コード例 #2
0
 public void DeleteItemFromCurrentRecording(SpeakerItem oDelete)
 {
     foreach (SpeakerItem oSpeaker in CurrentRecording)
     {
         if (oSpeaker.Equals(oDelete))
         {
             CurrentRecording.Remove(oSpeaker);
             break;
         }
     }
 }
コード例 #3
0
 public void DeleteRecordingItem(SpeakerItem oDelete)
 {
     Recorder.DeleteItemFromCurrentRecording(oDelete);
 }
コード例 #4
0
 public void UpdateItemInCurrentRecording(SpeakerItem oOldValue, SpeakerItem oNewVal)
 {
     Recorder.UpdateItemInCurrentRecording(oOldValue, oNewVal);
 }
コード例 #5
0
        public void RemoveBubbleGuy(bool bAllLocations, bool bIsSave, string sBubbleGuyId)
        {
#if LOG_DEBUG
            oMonitor.Log($"removing BubbleGuy. name '{BubbleGuyStatics.BubbleGuyName}'", LogLevel.Info);
#endif
            if (bAllLocations)
            {
                //
                //  all locations with a playerid is called
                //  when a farmhand (peer) quits.
                //
                foreach (GameLocation gl in Game1.locations)
                {
                    List <NPC> lDelete = new List <NPC> {
                    };
                    foreach (NPC oNpc in gl.characters)
                    {
                        if (oNpc.name.Value == sBubbleGuyId)
                        {
                            lDelete.Add(oNpc);
                        }
                    }
                    foreach (NPC oDel in lDelete)
                    {
                        gl.characters.Remove(oDel);
                    }
                }
            }
            else
            {
                if (!bIsSave)
                {
                    //
                    //  if recording, add clear mark to recording
                    //
                    if (Recorder.Status == BubbleRecorder.RecorderStatus.Recording)
                    {
                        SpeakerItem oNewItem = new SpeakerItem
                        {
                            IsThink  = false,
                            IsClear  = true,
                            Location = Game1.currentLocation.NameOrUniqueName,
                            TileX    = Game1.player.getTileX(),
                            TileY    = Game1.player.getTileY()
                        };
                        Recorder.CurrentRecording.Add(oNewItem);
                    }
                }
                if (Game1.IsMultiplayer && Game1.IsMasterGame && bIsSave)
                {
                    //
                    //  if host, clear the game of all bubble guys before the save
                    //
                    foreach (GameLocation gl in Game1.locations)
                    {
                        List <NPC> lDelete = new List <NPC> {
                        };
                        foreach (NPC oNpc in gl.characters)
                        {
                            if (oNpc.name.Value.StartsWith(BubbleGuyStatics.BubbleGuyPrefix))
                            {
                                lDelete.Add(oNpc);
                            }
                        }
                        foreach (NPC oDel in lDelete)
                        {
                            gl.characters.Remove(oDel);
                        }
                    }
                }
                else
                {
#if LOG_DEBUG
                    oMonitor.Log($"Location: {Game1.currentLocation.name.Value}, Characters: {string.Join(", ", Game1.currentLocation.characters.Select(p => p.name))}", LogLevel.Info);
#endif
                    //
                    //  remove any existing bubble guys if they exist
                    //
                    if (Game1.currentLocation.getCharacterFromName(sBubbleGuyId) is NPC oGuy)
                    {
                        Game1.currentLocation.characters.Remove(oGuy);
                    }
                }
            }
            IsBubbleVisible = false;
        }