Page 3 of 4
Re: Skip/Auto Button Help
Posted: Fri Mar 17, 2017 12:32 pm
by HawkX
Sorry to revive this thread...
I just found another small issue with my skip button!
Code: Select all
public void bouttonSkip ()
{
DialogueManager.StopConversation();
}
this code cannot be easier... however, I just noticed that stopping the conversation that way does NOT call the :
that we created a few weeks ago!
Since i have bool variables that keep track when a conversation starts and ends (to toggle visibility of certain buttons/etc)...
Can I manually callup OnConversationEnd directly in my skip button function?
Thanks, as always, and have a nice day!/Weekend!
Re: Skip/Auto Button Help
Posted: Fri Mar 17, 2017 12:49 pm
by Tony Li
Hi,
It may help to move the script to one of the participants, but if you can just manually call OnConversationEnd that's the quickest and easiest solution.
Re: Skip/Auto Button Help
Posted: Fri Mar 17, 2017 1:01 pm
by HawkX
Yup... I was once more coming back here to edit my post saying I added 2 lines to my skip button to do what i wanted to do on a cutscene end...
and that fixed it
Re: Skip/Auto Button Help
Posted: Thu Mar 23, 2017 4:33 pm
by HawkX
Another Revive of an old question of mine
I used the script you created on page 1 for my auto button to put in my option menu... it works fine IF there is a conversation running, however if there is not i get the following error :
Code: Select all
TargetException: Non-static field requires a target
System.Reflection.MonoField.GetValue (System.Object obj) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoField.cs:108)
GameSettingsOptions.ToggleAutoText (Boolean ATtoggle) (at Assets/Scripts/Settings/GameSettingsOptions.cs:130)
UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:189)
I did not copy the whole thing as it seems to be useless after that part...
I had to edit my post from here, because I changed the whole thing to separate a EnableAutoText and DisableAutoText (it made it easier to set it back after loading a game) - I should not here that I use my own save/load I had made prior to buying the Dialogue System... its a super easy binary formatter that saves all my global-static-variables that holds everything of "value"...
I am now 99% sure the error comes from the line :
Code: Select all
var sequencer = typeof(ConversationView).GetField ("sequencer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue (DialogueManager.ConversationView) as Sequencer;
When AutoDialogue is enabled while "not" in a conversation at all...
Here is a copy of my 3 methods to (toggle button, enable and disable)
Code: Select all
public void ToggleAutoText (bool ATtoggle)
{
if (ATtoggle)
{
EnableAutoText ();
}
else
{
DisableAutoText();
}
}
public void EnableAutoText ()
{
var oldMode = DialogueManager.DisplaySettings.subtitleSettings.continueButton;
{
if (oldMode == DisplaySettings.SubtitleSettings.ContinueButtonMode.Always)
{
var newMode = DisplaySettings.SubtitleSettings.ContinueButtonMode.Never;
DialogueManager.DisplaySettings.subtitleSettings.continueButton = newMode;
var sequencer = typeof(ConversationView).GetField ("sequencer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue (DialogueManager.ConversationView) as Sequencer;
if (!sequencer.IsPlaying)
{
DialogueManager.Instance.BroadcastMessage ("OnContinue", SendMessageOptions.DontRequireReceiver);
}
}
if (DialogueManager.ConversationView != null)
{
DialogueManager.ConversationView.SetupContinueButton ();
}
}
}
public void DisableAutoText ()
{
var oldMode = DialogueManager.DisplaySettings.subtitleSettings.continueButton;
if (oldMode == DisplaySettings.SubtitleSettings.ContinueButtonMode.Never)
{
var newMode = DisplaySettings.SubtitleSettings.ContinueButtonMode.Always;
DialogueManager.DisplaySettings.subtitleSettings.continueButton = newMode;
}
if (DialogueManager.ConversationView != null)
{
DialogueManager.ConversationView.SetupContinueButton ();
}
}
No idea what that error means... or what that "reflection" is... had to add it at the top with the other "using" otherwise there was red lines in there...
Its really not easy to be thorough and make a great option menu for the players! No wonder most games just dont care enough to take the time to create a great option menu!
Re: Skip/Auto Button Help
Posted: Thu Mar 23, 2017 9:00 pm
by Tony Li
Hi,
Good catch. Attention to details like this are what separate successful games from near-misses.
Change this line:
Code: Select all
if (newMode == DisplaySettings.SubtitleSettings.ContinueButtonMode.Never)
to this:
Code: Select all
if (DialogueManager.IsConversationActive && newMode == DisplaySettings.SubtitleSettings.ContinueButtonMode.Never)
Re: Skip/Auto Button Help
Posted: Thu Mar 23, 2017 9:51 pm
by HawkX
Thanks again for your incredible help! I honestly couldnt do it without you!
You did a few mistakes however in your reply
BUT with what you had written I was able to fix my code and it WORKS NOW!
you wrote to change this :
if (newMode == DisplaySettings.SubtitleSettings.ContinueButtonMode.Never)
into something else... however i dont even have a if (newMode -- anywhere)...
I simply added (if (DialogueManager.IsConversationActive)) before the var sequencer line... and that 100% fixed it!
So thanks for the assist!
Re: Skip/Auto Button Help
Posted: Thu Mar 23, 2017 10:14 pm
by Tony Li
Glad I could help!
Re: Skip/Auto Button Help
Posted: Fri Mar 24, 2017 3:01 pm
by HawkX
God I cant seem to catch a break...
Found another bug with my SKIP button today..
Although this might be a Unity bug...
Here is my skip button code (cant be more easy)
Code: Select all
public class DialogueSkipButton : MonoBehaviour {
public void bouttonSkip ()
{
DialogueManager.StopConversation();
GV.inCutscene = false;
}
}
GV is a static class where i hold all my global variable that I can access super easily from anywhere...
Problem is that in ONE instance, I have 3 different conversations Immediately one after the other...
If I skip the first one, the 2nd starts, but i can spam the skip button, nothing happens...
If i continue through the 2nd one, I can skip the 3rd one...
If i "continue" through the first one, i can skip the 2nd one... but then I cant skip the 3rd one!
I though it might be some bug with the event system in unity... but cant seem to find any reference to this... I also clicked on a separate button (to change focus) and it did not help... still cant skip if i skipped one right before...
Re: Skip/Auto Button Help
Posted: Fri Mar 24, 2017 3:13 pm
by Tony Li
How are you starting the conversations?
Re: Skip/Auto Button Help
Posted: Fri Mar 24, 2017 3:25 pm
by HawkX
hehehe I just posted the answer to that in that other thread
lol...
here :
Code: Select all
void StartConversation ()
{
if (DialogueManager.MasterDatabase.GetConversation (GV.stringCurrentFightLocation + intFightPhase.ToString()) != null)
{
DialogueManager.StartConversation (GV.stringCurrentFightLocation + intFightPhase.ToString(), girlname.transform);
}
}