Sharing Data between Room Ext and Zone Ext

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Baiumka
Posts: 9
Joined: 04 Dec 2018, 09:57

Sharing Data between Room Ext and Zone Ext

Postby Baiumka » 29 Nov 2022, 11:45

Hello. I can`t get information from Zone Ext in my game-room.

Code: Select all

package ZoneExtension;

    public class ZoneExtension extends SFSExtension{
        private UnitModelFabric unitModelFabric;
        public static ZoneExtension zone;

        @Override
        public void init() {
            zone = this;       
            unitModelFabric = new UnitModelFabric();           
        }

        @Override
        public void destroy()
        {
            super.destroy();
        }
       
        public UnitModelFabric getFabric()
        {
            return unitModelFabric;
        }
    }


Code: Select all

package GameRoomExtension;
public class GameRoomExtension extends SFSExtension {
    @Override
    public void init() {
           int modelCount = ZoneExtension.zone.getFabric().getUnitModelList().size();//Here ZoneExtension.zone is null
    }
}


I already read this thread: viewtopic.php?t=11643 but it seems too old. I not found .javaExtension/ in any config. Please help me.

P.S. Sorry for my bad knowlage of language.
User avatar
Lapo
Site Admin
Posts: 22609
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Sharing Data between Room Ext and Zone Ext

Postby Lapo » 30 Nov 2022, 16:17

Hi,
the article you have linked to is for SmartFoxServer 1.x while you're working with SmartFoxServer 2X.

You can check the documentation here:
http://docs2x.smartfoxserver.com/Extens ... assLoading

The section I have linked explains how Extension work behind the scenes and how to deal with scenarios like the one you have posted.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 30 guests