playMaker

Author Topic: Photon Get offline mode status [SOLVED]  (Read 3328 times)

serenefox

  • Full Member
  • ***
  • Posts: 135
    • Serenefox Games
Photon Get offline mode status [SOLVED]
« on: March 20, 2017, 01:08:07 PM »
Hi,

I am trying to create an action to "get" if offline mode is active with photon. I duplicated the "set" action and modified it. This is what is have so far:

Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Photon")]
[Tooltip("Gets if the PhotonNetwork is offline or not. Offline mode can be set to re-use your multiplayer code in singleplayer game modes." +
"\n When this is on PhotonNetwork will not create any connections and there is near to " +
"no overhead. Mostly usefull for reusing RPC's and PhotonNetwork.Instantiate")]
//[HelpUrl("https://hutonggames.fogbugz.com/default.asp?W1108")]
public class PhotonNetworkGetOfflineMode : FsmStateAction
{
private bool offlineMode;

[Tooltip("Event to send if the Bool variable is True.")]
public FsmEvent isTrue;

        [Tooltip("Event to send if the Bool variable is False.")]
public FsmEvent isFalse;

public override void Reset()
{
isTrue = null;
isFalse = null;
}

public override void OnEnter()
{
offlineMode = PhotonNetwork.offlineMode;
Fsm.Event(offlineMode ? isTrue : isFalse);
Finish();
}

}
}


It always returns either false or true I can't remember but it just doesn't work anyway. Is there an action or way I can get the status of offline mode. Is this possible? Or is the code above wrong?
« Last Edit: March 24, 2017, 11:14:09 AM by serenefox »
Most Recent Published Games:
Juicy Theater - Android

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon Get offline mode status
« Reply #1 on: March 21, 2017, 02:30:46 AM »
Hi,

 that should be it yes ( maybe you check too soon). Anyway, this should be provided within the package, I'll include this action you made and will test to make sure it works.

 Bye,

 Jean

serenefox

  • Full Member
  • ***
  • Posts: 135
    • Serenefox Games
Re: Photon Get offline mode status
« Reply #2 on: March 21, 2017, 04:56:51 AM »
Hi Jean,

I did a test to see if I was checking too soon, but the results were the same. If you could let me know when you test it and what the results are on your end that would be awesome thanks.
Most Recent Published Games:
Juicy Theater - Android

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: Photon Get offline mode status
« Reply #3 on: March 21, 2017, 08:52:25 AM »
This would be great.
For now I use a global bool variable that I set when the offline mode is set (because I change scenes) and it works great.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon Get offline mode status
« Reply #4 on: March 22, 2017, 09:47:43 AM »
Hi,

 Ok, I tested and I don't see anything wrong, offline mode check returns true when I set it.

 Maybe you could share a repro? pm me :)

 Bye,

 Jean

serenefox

  • Full Member
  • ***
  • Posts: 135
    • Serenefox Games
Re: Photon Get offline mode status
« Reply #5 on: March 24, 2017, 08:13:37 AM »
Hey Jean,

Maybe I am doing it wrong. When I am testing the action I just set the offline/online modes in the editor photon settings before running the game, do I have to set it true/false in code or with the action first for it to register?
Most Recent Published Games:
Juicy Theater - Android

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon Get offline mode status
« Reply #6 on: March 24, 2017, 09:45:35 AM »
Hi,

 I see! no no, the offline mode is something you should set in code, I am not even sure what the offline mode does in the photon settings.

Bye,
 
 Jean

serenefox

  • Full Member
  • ***
  • Posts: 135
    • Serenefox Games
Re: Photon Get offline mode status
« Reply #7 on: March 24, 2017, 11:13:16 AM »
Oh ok! Thanks for clearing that up.   :)
Most Recent Published Games:
Juicy Theater - Android