playMaker

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

serenefox

  • Junior Playmaker
  • **
  • Posts: 83
    • View Profile
    • Serenefox Games
Photon Get offline mode status [SOLVED]
« on: March 20, 2017, 10:08:07 AM »
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, 08:14:09 AM by serenefox »
Recent Published Games:

Don't Pop! Dungeon - iOS/Android

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Photon Get offline mode status
« Reply #1 on: March 20, 2017, 11:30:46 PM »
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

  • Junior Playmaker
  • **
  • Posts: 83
    • View Profile
    • Serenefox Games
Re: Photon Get offline mode status
« Reply #2 on: March 21, 2017, 01: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.
Recent Published Games:

Don't Pop! Dungeon - iOS/Android

600

  • Sr. Member
  • ****
  • Posts: 494
    • View Profile
    • Car and Traffic Playmaker assets
Re: Photon Get offline mode status
« Reply #3 on: March 21, 2017, 05: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: 12351
  • Official Playmaker Support
    • View Profile
Re: Photon Get offline mode status
« Reply #4 on: March 22, 2017, 06: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

  • Junior Playmaker
  • **
  • Posts: 83
    • View Profile
    • Serenefox Games
Re: Photon Get offline mode status
« Reply #5 on: March 24, 2017, 05: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?
Recent Published Games:

Don't Pop! Dungeon - iOS/Android

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Photon Get offline mode status
« Reply #6 on: March 24, 2017, 06: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

  • Junior Playmaker
  • **
  • Posts: 83
    • View Profile
    • Serenefox Games
Re: Photon Get offline mode status
« Reply #7 on: March 24, 2017, 08:13:16 AM »
Oh ok! Thanks for clearing that up.   :)
Recent Published Games:

Don't Pop! Dungeon - iOS/Android