This commit is contained in:
2025-11-24 14:19:51 +05:30
commit f5c1412b28
6734 changed files with 1527575 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,171 @@
/*
* Original work: Copyright (c) 2014, Oculus VR, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* RakNet License.txt file in the licenses directory of this source tree. An additional grant
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
*
*
* Modified work: Copyright (c) 2017-2019, SLikeSoft UG (haftungsbeschränkt)
*
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
* license found in the license.txt file in the root directory of this source tree.
*/
#ifndef __ROOMS_BROWSER_GFX3_RAKNET
#define __ROOMS_BROWSER_GFX3_RAKNET
#include "slikenet/WindowsIncludes.h"
#include "slikenet/types.h"
#include "Lobby2Message.h"
#include "slikenet/PluginInterface2.h"
#include "RoomsBrowserGFx3.h"
#include "RoomsPlugin.h"
namespace SLNet {
/// This is data that should be set with RakPeerInterface::SetOfflinePingResponse()
/// It should also be able to write this data to a LobbyServer instance
struct ServerAndRoomBrowserData
{
unsigned short numPlayers;
unsigned short maxPlayers;
SLNet::RakString mapName;
SLNet::RakString roomName;
SLNet::RakNetGUID roomId;
/// For the LAN browser, it expects the offline ping response to be packed using the format from this structure
/// Therefore, to advertise that your server is available or updated, fill out the parameters in this structure, then call SetAsOfflinePingResponse()
/// When your server is no longer available, set the offline ping response to null
void SetAsOfflinePingResponse(SLNet::RakPeerInterface *rakPeer);
/// Write to a RakNet table data structure, useful when creating the room or setting the room properties
/// Writes everything EXCEPT the list of players
void WriteToTable(DataStructures::Table *table);
/// \internal
void Serialize(SLNet::BitStream *bitStream, bool writeToBitstream);
};
// GFxPlayerTinyD3D9.cpp has an instance of this class, and callls the corresponding 3 function
// This keeps the patching code out of the GFx sample as much as possible
class RoomsBrowserGFx3_RakNet : public RoomsBrowserGFx3, public SLNet::Lobby2Callbacks, public PluginInterface2, SLNet::RoomsCallback
{
public:
RoomsBrowserGFx3_RakNet();
virtual ~RoomsBrowserGFx3_RakNet();
virtual void Init(SLNet::Lobby2Client *_lobby2Client,
SLNet::Lobby2MessageFactory *_messageFactory,
RakPeerInterface *_rakPeer,
SLNet::RoomsPlugin *_roomsPlugin,
SLNet::RakString _titleName,
SLNet::RakString _titleSecretKey,
SLNet::RakString _pathToXMLPropertyFile,
unsigned short _lanServerPort,
GPtr<FxDelegate> pDelegate,
GPtr<GFxMovieView> pMovie);
void Update(void);
void Shutdown(void);
// Update all callbacks from flash
void Accept(CallbackProcessor* cbreg);
virtual const char *QueryPlatform(void) const {return "RakNet";}
virtual void SaveProperty(const char *propertyId, const char *propertyValue);
virtual void LoadProperty(const char *propertyId, SLNet::RakString &propertyOut);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_ConnectToServer);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_Login);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_RegisterAccount);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_UpdateRoomsList);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_UpdateFriendsList);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_JoinByFilter);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_CreateRoom);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_Friends_SendInvite);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_Friends_Remove);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_Friends_AcceptInvite);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_Friends_RejectInvite);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_Directed_Chat_Func);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_Room_Chat_Func);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_Logoff);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_LeaveRoom);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_SendInvite);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_StartSpectating);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_StopSpectating);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_GrantModerator);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_SetReadyStatus);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_GetReadyStatus);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_SetRoomLockState);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_GetRoomLockState);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_AreAllMembersReady);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_KickMember);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_GetRoomProperties);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_StartGame);
// Lobby2
virtual void MessageResult(SLNet::Client_Login *message);
virtual void MessageResult(SLNet::Client_Logoff *message);
virtual void MessageResult(SLNet::Client_RegisterAccount *message);
virtual void MessageResult(SLNet::Friends_GetFriends *message);
virtual void MessageResult(SLNet::Friends_GetInvites *message);
virtual void MessageResult(SLNet::Friends_SendInvite *message);
virtual void MessageResult(SLNet::Friends_AcceptInvite *message);
virtual void MessageResult(SLNet::Friends_RejectInvite *message);
virtual void MessageResult(SLNet::Friends_Remove *message);
virtual void MessageResult(SLNet::Notification_Friends_PresenceUpdate *message);
virtual void MessageResult(SLNet::Notification_Friends_StatusChange *message);
// PluginInterface2
virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason );
virtual void OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming);
virtual void OnFailedConnectionAttempt(Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason);
virtual PluginReceiveResult OnReceive(Packet *packet);
/// Rooms callbacks
virtual void CreateRoom_Callback( const SystemAddress &senderAddress, SLNet::CreateRoom_Func *callResult);
virtual void SearchByFilter_Callback( const SystemAddress &senderAddress, SLNet::SearchByFilter_Func *callResult);
virtual void JoinByFilter_Callback( const SystemAddress &senderAddress, SLNet::JoinByFilter_Func *callResult);
virtual void Chat_Callback( const SystemAddress &senderAddress, SLNet::Chat_Func *callResult);
virtual void Chat_Callback( const SystemAddress &senderAddress, SLNet::Chat_Notification *notification);
virtual void LeaveRoom_Callback( const SystemAddress &senderAddress, SLNet::LeaveRoom_Func *callResult);
virtual void SendInvite_Callback( const SystemAddress &senderAddress, SLNet::SendInvite_Func *callResult);
virtual void StartSpectating_Callback( const SystemAddress &senderAddress, SLNet::StartSpectating_Func *callResult);
virtual void StopSpectating_Callback( const SystemAddress &senderAddress, SLNet::StopSpectating_Func *callResult);
virtual void GrantModerator_Callback( const SystemAddress &senderAddress, SLNet::GrantModerator_Func *callResult);
virtual void SetReadyStatus_Callback( const SystemAddress &senderAddress, SLNet::SetReadyStatus_Func *callResult);
virtual void GetReadyStatus_Callback( const SystemAddress &senderAddress, SLNet::GetReadyStatus_Func *callResult);
virtual void SetRoomLockState_Callback( const SystemAddress &senderAddress, SLNet::SetRoomLockState_Func *callResult);
virtual void GetRoomLockState_Callback( const SystemAddress &senderAddress, SLNet::GetRoomLockState_Func *callResult);
virtual void AreAllMembersReady_Callback( const SystemAddress &senderAddress, SLNet::AreAllMembersReady_Func *callResult);
virtual void KickMember_Callback( const SystemAddress &senderAddress, SLNet::KickMember_Func *callResult);
virtual void GetRoomProperties_Callback( const SystemAddress &senderAddress, SLNet::GetRoomProperties_Func *callResult);
// Notifications due to other room members
virtual void RoomMemberStartedSpectating_Callback( const SystemAddress &senderAddress, SLNet::RoomMemberStartedSpectating_Notification *notification);
virtual void RoomMemberStoppedSpectating_Callback( const SystemAddress &senderAddress, SLNet::RoomMemberStoppedSpectating_Notification *notification);
virtual void ModeratorChanged_Callback( const SystemAddress &senderAddress, SLNet::ModeratorChanged_Notification *notification);
virtual void RoomMemberReadyStatusSet_Callback( const SystemAddress &senderAddress, SLNet::RoomMemberReadyStatusSet_Notification *notification);
virtual void RoomLockStateSet_Callback( const SystemAddress &senderAddress, SLNet::RoomLockStateSet_Notification *notification);
virtual void RoomMemberKicked_Callback( const SystemAddress &senderAddress, SLNet::RoomMemberKicked_Notification *notification);
virtual void RoomMemberLeftRoom_Callback( const SystemAddress &senderAddress, SLNet::RoomMemberLeftRoom_Notification *notification);
virtual void RoomMemberJoinedRoom_Callback( const SystemAddress &senderAddress, SLNet::RoomMemberJoinedRoom_Notification *notification);
virtual void RoomInvitationSent_Callback( const SystemAddress &senderAddress, SLNet::RoomInvitationSent_Notification *notification);
virtual void RoomInvitationWithdrawn_Callback( const SystemAddress &senderAddress, SLNet::RoomInvitationWithdrawn_Notification *notification);
virtual void RoomDestroyedOnModeratorLeft_Callback( const SystemAddress &senderAddress, SLNet::RoomDestroyedOnModeratorLeft_Notification *notification);
SLNet::Lobby2Client *lobby2Client;
SLNet::Lobby2MessageFactory *msgFactory;
SLNet::RakPeerInterface *rakPeer;
SLNet::RakString titleName;
SLNet::RakString titleSecretKey;
SLNet::RakString pathToXMLPropertyFile;
SLNet::RakString loginUsername;
SLNet::RoomsPlugin *roomsPlugin;
unsigned short lanServerPort;
};
} // namespace SLNet
#endif // __ROOMS_BROWSER_GFX3_RAKNET

View File

@ -0,0 +1,285 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug - Unicode|Win32">
<Configuration>Debug - Unicode</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release - Unicode|Win32">
<Configuration>Release - Unicode</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Retail - Unicode|Win32">
<Configuration>Retail - Unicode</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Retail|Win32">
<Configuration>Retail</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{1E7A1DCE-807E-474B-B065-14F8C93A1D6C}</ProjectGuid>
<RootNamespace>Lobby2Client</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Retail|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release - Unicode|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Retail - Unicode|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug - Unicode|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Retail|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release - Unicode|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Retail - Unicode|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug - Unicode|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug - Unicode|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug - Unicode|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Retail|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release - Unicode|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Retail - Unicode|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Retail|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release - Unicode|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Retail - Unicode|Win32'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)DependentExtensions\XML;$(SolutionDir)Source/include;$(SolutionDir)DependentExtensions/Lobby2/Rooms;$(SolutionDir)DependentExtensions/GFx3;$(SolutionDir)Samples/RoomsBrowserGFx3;$(ProjectDir);$(SolutionDir)DependentExtensions/Lobby2;$(GFXSDK)\Src\GRenderer;$(GFXSDK)\Src\GKernel;$(GFXSDK)\Src\GFxXML;$(GFXSDK)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<AdditionalDependencies>../../../lib/SLikeNet_LibStatic_Debug_Win32.lib;ws2_32.lib;libgfx.lib;libjpeg.lib;zlib.lib;imm32.lib;winmm.lib;libgrenderer_d3d9.lib;d3dx9.lib;d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(DXSDK_DIR)\Lib\x86;$(GFXSDK)\3rdParty\expat-2.0.1\lib;$(GFXSDK)\Lib\$(Platform)\Msvc80\Debug\;$(GFXSDK)\3rdParty\zlib-1.2.3\Lib\$(Platform)\Msvc80\Debug;$(GFXSDK)\3rdParty\jpeg-6b\Lib\$(Platform)\Msvc80\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug - Unicode|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)DependentExtensions\XML;$(SolutionDir)Source/include;$(SolutionDir)DependentExtensions/Lobby2/Rooms;$(SolutionDir)DependentExtensions/GFx3;$(SolutionDir)Samples/RoomsBrowserGFx3;$(ProjectDir);$(SolutionDir)DependentExtensions/Lobby2;$(GFXSDK)\Src\GRenderer;$(GFXSDK)\Src\GKernel;$(GFXSDK)\Src\GFxXML;$(GFXSDK)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<AdditionalDependencies>../../../lib/SLikeNet_LibStatic_Debug - Unicode_Win32.lib;ws2_32.lib;libgfx.lib;libjpeg.lib;zlib.lib;imm32.lib;winmm.lib;libgrenderer_d3d9.lib;d3dx9.lib;d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(DXSDK_DIR)\Lib\x86;$(GFXSDK)\3rdParty\expat-2.0.1\lib;$(GFXSDK)\Lib\$(Platform)\Msvc80\Debug\;$(GFXSDK)\3rdParty\zlib-1.2.3\Lib\$(Platform)\Msvc80\Debug;$(GFXSDK)\3rdParty\jpeg-6b\Lib\$(Platform)\Msvc80\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)DependentExtensions\XML;$(SolutionDir)Source/include;$(SolutionDir)DependentExtensions/Lobby2/Rooms;$(SolutionDir)DependentExtensions/GFx3;$(SolutionDir)Samples/RoomsBrowserGFx3;$(ProjectDir);$(SolutionDir)DependentExtensions/Lobby2;$(GFXSDK)\Src\GRenderer;$(GFXSDK)\Src\GKernel;$(GFXSDK)\Src\GFxXML;$(GFXSDK)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<MinimalRebuild>true</MinimalRebuild>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<AdditionalDependencies>../../../lib/SLikeNet_LibStatic_Release_Win32.lib;ws2_32.lib;libgfx.lib;libjpeg.lib;zlib.lib;imm32.lib;winmm.lib;libgrenderer_d3d9.lib;d3dx9.lib;d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(DXSDK_DIR)\Lib\x86;$(GFXSDK)\3rdParty\expat-2.0.1\lib;$(GFXSDK)\Lib\$(Platform)\Msvc80\Release\;$(GFXSDK)\3rdParty\zlib-1.2.3\Lib\$(Platform)\Msvc80\Release;$(GFXSDK)\3rdParty\jpeg-6b\Lib\$(Platform)\Msvc80\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Retail|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)DependentExtensions\XML;$(SolutionDir)Source/include;$(SolutionDir)DependentExtensions/Lobby2/Rooms;$(SolutionDir)DependentExtensions/GFx3;$(SolutionDir)Samples/RoomsBrowserGFx3;$(ProjectDir);$(SolutionDir)DependentExtensions/Lobby2;$(GFXSDK)\Src\GRenderer;$(GFXSDK)\Src\GKernel;$(GFXSDK)\Src\GFxXML;$(GFXSDK)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;_RETAIL;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<MinimalRebuild>true</MinimalRebuild>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<AdditionalDependencies>../../../lib/SLikeNet_LibStatic_Retail_Win32.lib;ws2_32.lib;libgfx.lib;libjpeg.lib;zlib.lib;imm32.lib;winmm.lib;libgrenderer_d3d9.lib;d3dx9.lib;d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(DXSDK_DIR)\Lib\x86;$(GFXSDK)\3rdParty\expat-2.0.1\lib;$(GFXSDK)\Lib\$(Platform)\Msvc80\Release\;$(GFXSDK)\3rdParty\zlib-1.2.3\Lib\$(Platform)\Msvc80\Release;$(GFXSDK)\3rdParty\jpeg-6b\Lib\$(Platform)\Msvc80\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release - Unicode|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)DependentExtensions\XML;$(SolutionDir)Source/include;$(SolutionDir)DependentExtensions/Lobby2/Rooms;$(SolutionDir)DependentExtensions/GFx3;$(SolutionDir)Samples/RoomsBrowserGFx3;$(ProjectDir);$(SolutionDir)DependentExtensions/Lobby2;$(GFXSDK)\Src\GRenderer;$(GFXSDK)\Src\GKernel;$(GFXSDK)\Src\GFxXML;$(GFXSDK)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<MinimalRebuild>true</MinimalRebuild>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<AdditionalDependencies>../../../lib/SLikeNet_LibStatic_Release - Unicode_Win32.lib;ws2_32.lib;libgfx.lib;libjpeg.lib;zlib.lib;imm32.lib;winmm.lib;libgrenderer_d3d9.lib;d3dx9.lib;d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(DXSDK_DIR)\Lib\x86;$(GFXSDK)\3rdParty\expat-2.0.1\lib;$(GFXSDK)\Lib\$(Platform)\Msvc80\Release\;$(GFXSDK)\3rdParty\zlib-1.2.3\Lib\$(Platform)\Msvc80\Release;$(GFXSDK)\3rdParty\jpeg-6b\Lib\$(Platform)\Msvc80\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Retail - Unicode|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)DependentExtensions\XML;$(SolutionDir)Source/include;$(SolutionDir)DependentExtensions/Lobby2/Rooms;$(SolutionDir)DependentExtensions/GFx3;$(SolutionDir)Samples/RoomsBrowserGFx3;$(ProjectDir);$(SolutionDir)DependentExtensions/Lobby2;$(GFXSDK)\Src\GRenderer;$(GFXSDK)\Src\GKernel;$(GFXSDK)\Src\GFxXML;$(GFXSDK)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;_RETAIL;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<MinimalRebuild>true</MinimalRebuild>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<AdditionalDependencies>../../../lib/SLikeNet_LibStatic_Retail - Unicode_Win32.lib;ws2_32.lib;libgfx.lib;libjpeg.lib;zlib.lib;imm32.lib;winmm.lib;libgrenderer_d3d9.lib;d3dx9.lib;d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(DXSDK_DIR)\Lib\x86;$(GFXSDK)\3rdParty\expat-2.0.1\lib;$(GFXSDK)\Lib\$(Platform)\Msvc80\Release\;$(GFXSDK)\3rdParty\zlib-1.2.3\Lib\$(Platform)\Msvc80\Release;$(GFXSDK)\3rdParty\jpeg-6b\Lib\$(Platform)\Msvc80\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\RoomsBrowserGFx3.cpp" />
<ClCompile Include="RoomsBrowserGFx3_RakNet.cpp" />
<ClCompile Include="..\..\..\DependentExtensions\XML\xmlParser.cpp" />
<ClCompile Include="$(SolutionDir)DependentExtensions\GFx3\FxGameDelegate.cpp" />
<ClCompile Include="..\GFxPlayerTinyD3D9.cpp" />
<ClCompile Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Client.cpp" />
<ClCompile Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Message.cpp" />
<ClCompile Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Plugin.cpp" />
<ClCompile Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Presence.cpp" />
<ClCompile Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2ResultCode.cpp" />
<ClCompile Include="..\..\..\DependentExtensions\Lobby2\Rooms\IntervalTimer.cpp" />
<ClCompile Include="..\..\..\DependentExtensions\Lobby2\Rooms\ProfanityFilter.cpp" />
<ClCompile Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomsContainer.cpp" />
<ClCompile Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomsErrorCodes.cpp" />
<ClCompile Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomsPlugin.cpp" />
<ClCompile Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomTypes.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\RoomsBrowserGFx3.h" />
<ClInclude Include="RoomsBrowserGFx3_RakNet.h" />
<ClInclude Include="..\..\..\DependentExtensions\XML\xmlParser.h" />
<ClInclude Include="$(SolutionDir)DependentExtensions\GFx3\FxGameDelegate.h" />
<ClInclude Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Client.h" />
<ClInclude Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Message.h" />
<ClInclude Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Plugin.h" />
<ClInclude Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Presence.h" />
<ClInclude Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2ResultCode.h" />
<ClInclude Include="..\..\..\DependentExtensions\Lobby2\Rooms\IntervalTimer.h" />
<ClInclude Include="..\..\..\DependentExtensions\Lobby2\Rooms\ProfanityFilter.h" />
<ClInclude Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomsContainer.h" />
<ClInclude Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomsErrorCodes.h" />
<ClInclude Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomsPlugin.h" />
<ClInclude Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomTypes.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Main">
<UniqueIdentifier>{ed9d0796-f81c-411f-9efa-a11ea9dbf102}</UniqueIdentifier>
</Filter>
<Filter Include="GFx3">
<UniqueIdentifier>{c71ca9bf-67e9-4126-aef2-8a522e7c87b1}</UniqueIdentifier>
</Filter>
<Filter Include="Lobby2">
<UniqueIdentifier>{572fffb7-927d-432d-99eb-f3b0662a49c6}</UniqueIdentifier>
</Filter>
<Filter Include="RoomsPlugin">
<UniqueIdentifier>{bb97be60-4eab-40e0-b3e2-7ffe3a682c24}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\RoomsBrowserGFx3.cpp">
<Filter>Main</Filter>
</ClCompile>
<ClCompile Include="RoomsBrowserGFx3_RakNet.cpp">
<Filter>Main</Filter>
</ClCompile>
<ClCompile Include="..\..\..\DependentExtensions\XML\xmlParser.cpp">
<Filter>Main</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)DependentExtensions\GFx3\FxGameDelegate.cpp">
<Filter>GFx3</Filter>
</ClCompile>
<ClCompile Include="..\GFxPlayerTinyD3D9.cpp">
<Filter>GFx3</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Client.cpp">
<Filter>Lobby2</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Message.cpp">
<Filter>Lobby2</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Plugin.cpp">
<Filter>Lobby2</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Presence.cpp">
<Filter>Lobby2</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2ResultCode.cpp">
<Filter>Lobby2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\DependentExtensions\Lobby2\Rooms\IntervalTimer.cpp">
<Filter>RoomsPlugin</Filter>
</ClCompile>
<ClCompile Include="..\..\..\DependentExtensions\Lobby2\Rooms\ProfanityFilter.cpp">
<Filter>RoomsPlugin</Filter>
</ClCompile>
<ClCompile Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomsContainer.cpp">
<Filter>RoomsPlugin</Filter>
</ClCompile>
<ClCompile Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomsErrorCodes.cpp">
<Filter>RoomsPlugin</Filter>
</ClCompile>
<ClCompile Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomsPlugin.cpp">
<Filter>RoomsPlugin</Filter>
</ClCompile>
<ClCompile Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomTypes.cpp">
<Filter>RoomsPlugin</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\RoomsBrowserGFx3.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="RoomsBrowserGFx3_RakNet.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="..\..\..\DependentExtensions\XML\xmlParser.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)DependentExtensions\GFx3\FxGameDelegate.h">
<Filter>GFx3</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Client.h">
<Filter>Lobby2</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Message.h">
<Filter>Lobby2</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Plugin.h">
<Filter>Lobby2</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2Presence.h">
<Filter>Lobby2</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)DependentExtensions\Lobby2\Lobby2ResultCode.h">
<Filter>Lobby2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\DependentExtensions\Lobby2\Rooms\IntervalTimer.h">
<Filter>RoomsPlugin</Filter>
</ClInclude>
<ClInclude Include="..\..\..\DependentExtensions\Lobby2\Rooms\ProfanityFilter.h">
<Filter>RoomsPlugin</Filter>
</ClInclude>
<ClInclude Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomsContainer.h">
<Filter>RoomsPlugin</Filter>
</ClInclude>
<ClInclude Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomsErrorCodes.h">
<Filter>RoomsPlugin</Filter>
</ClInclude>
<ClInclude Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomsPlugin.h">
<Filter>RoomsPlugin</Filter>
</ClInclude>
<ClInclude Include="..\..\..\DependentExtensions\Lobby2\Rooms\RoomTypes.h">
<Filter>RoomsPlugin</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -0,0 +1,84 @@
import flash.external.*;
loginButton.addEventListener("click", this, "Login");
function Login()
{
ExternalInterface.call("f2c_Login", usernameTextInput.text, passwordTextInput.text);
}
registerAccountButton.addEventListener("click", this, "registerAccount");
function registerAccount()
{
ExternalInterface.call("f2c_RegisterAccount", usernameTextInput.text, passwordTextInput.text);
}
ExternalInterface.addCallback("c2f_Client_Login", this, c2f_Client_Login);
function c2f_Client_Login(resultCode:String):Void
{
if (resultCode=="L2RC_SUCCESS")
{
// Save this account
ExternalInterface.call("f2c_SaveProperty", "DefaultUsername", usernameTextInput.text);
ExternalInterface.call("f2c_SaveProperty", "DefaultPassword", passwordTextInput.text);
// Goto logged in screen
gotoAndStop("Lobby");
}
else
{
// L2RC_Client_Login_HANDLE_NOT_IN_USE_OR_BAD_SECRET_KEY
// L2RC_Client_Login_EMAIL_ADDRESS_NOT_VALIDATED
// L2RC_Client_Login_CDKEY_STOLEN
// L2RC_Client_Login_BANNED
trace(resultCode);
}
}
ExternalInterface.addCallback("c2f_Client_RegisterAccount", this, c2f_Client_RegisterAccount);
function c2f_Client_RegisterAccount(resultCode:String):Void
{
if (resultCode=="L2RC_SUCCESS")
{
// Try to login with this account now
ExternalInterface.call("f2c_Login", usernameTextInput.text, passwordTextInput.text);
}
else
{
// L2RC_PROFANITY_FILTER_CHECK_FAILED
// L2RC_Client_RegisterAccount_HANDLE_ALREADY_IN_USE
// L2RC_Client_RegisterAccount_REQUIRES_CD_KEY
// L2RC_Client_RegisterAccount_CD_KEY_NOT_USABLE
// L2RC_Client_RegisterAccount_CD_KEY_NOT_USABLE
// L2RC_Client_RegisterAccount_CD_KEY_STOLEN
// L2RC_Client_RegisterAccount_CD_KEY_ALREADY_USED
trace(resultCode);
}
}
ExternalInterface.addCallback("c2f_LoadProperty_DefaultUsername", this, c2f_LoadProperty_DefaultUsername);
ExternalInterface.addCallback("c2f_LoadProperty_DefaultPassword", this, c2f_LoadProperty_DefaultPassword);
// Ask for last used account
function FillInUsernameAndPassword()
{
ExternalInterface.call("f2c_LoadProperty", "DefaultUsername", "c2f_LoadProperty_DefaultUsername");
ExternalInterface.call("f2c_LoadProperty", "DefaultPassword", "c2f_LoadProperty_DefaultPassword");
}
function c2f_LoadProperty_DefaultUsername(property:String):Void
{
usernameTextInput.text=property;
}
function c2f_LoadProperty_DefaultPassword(property:String):Void
{
passwordTextInput.text=property;
}
FillInUsernameAndPassword();
stop();

View File

@ -0,0 +1,36 @@
import flash.external.*;
connectToServerButton.addEventListener("click", this, "connectToServer");
ExternalInterface.addCallback("c2f_connectToServer_callback", this, c2f_connectToServer_callback);
function connectToServer()
{
ExternalInterface.call("f2c_ConnectToServer", ipAddressTextInput.text, portTextInput.text, "c2f_connectToServer_callback");
}
function c2f_connectToServer_callback(callSucceeded : Boolean)
{
if (callSucceeded==false)
gotoAndStop("Main");
}
ExternalInterface.addCallback("c2f_NotifyConnectionAttemptToServerSuccess", this, c2f_NotifyConnectionAttemptToServerSuccess);
function c2f_NotifyConnectionAttemptToServerSuccess():Void
{
gotoAndStop("Accounts_RakNet");
}
ExternalInterface.addCallback("c2f_NotifyConnectionAttemptToServerFailure", this, c2f_NotifyConnectionAttemptToServerFailure);
function c2f_NotifyConnectionAttemptToServerFailure(resultCode:String, systemAddress:String):Void
{
// Result codes are:
// CONNECTION_ATTEMPT_FAILED
// ALREADY_CONNECTED
// NO_FREE_INCOMING_CONNECTIONS
// RSA_PUBLIC_KEY_MISMATCH
// CONNECTION_BANNED
// INVALID_PASSWORD
trace(resultCode);
gotoAndStop("Main");
}
stop();

View File

@ -0,0 +1,64 @@
import flash.external.*;
ExternalInterface.addCallback("c2f_QueryPlatform_CreateRoom_Callback", this, c2f_QueryPlatform_CreateRoom_Callback);
ExternalInterface.call("f2c_QueryPlatform","c2f_QueryPlatform_CreateRoom_Callback");
function c2f_QueryPlatform_CreateRoom_Callback(platform:String):Void
{
if (platform=="RakNet")
{
}
else
{
lanGameCheckbox.visible=false;
roomMembersCanInviteCheckbox.visible=false;
}
}
cancelButton.addEventListener("click", this, "Cancel");
function Cancel()
{
gotoAndStop("Lobby");
}
okButton.addEventListener("click", this, "CreateRoom");
function CreateRoom()
{
ExternalInterface.call("f2c_CreateRoom",
[roomNameTextInput.text,
mapNameTextInput.text,
Number(publicSlotsTextInput.text),
Number(reservedSlotsTextInput.text),
hiddenFromSearchesCheckbox.selected,
roomMembersCanInviteCheckbox.selected,
lanGameCheckbox.selected
]);
}
// Duplicated
ExternalInterface.addCallback("c2f_CreateRoom", this, c2f_CreateRoom);
function c2f_CreateRoom(resultCode:String, isLanGame:Boolean):Void
{
if (resultCode=="REC_SUCCESS")
{
if (isLanGame)
{
gotoAndStop("InGame");
}
else
{
gotoAndStop("InRoom");
}
}
else
{
trace("c2f_CreateRoom failure. Result= " + resultCode);
/*
REC_CREATE_ROOM_UNKNOWN_TITLE,
REC_CREATE_ROOM_CURRENTLY_IN_QUICK_JOIN,
REC_CREATE_ROOM_CURRENTLY_IN_A_ROOM,
*/
}
}

View File

@ -0,0 +1,8 @@
import flash.external.*;
ExternalInterface.addCallback("c2f_NotifyServerConnectionLost", this, c2f_NotifyServerConnectionLost);
function c2f_NotifyServerConnectionLost(reason:String):Void
{
trace("Server connection lost. Reason=" + reason);
gotoAndStop("Main");
}

View File

@ -0,0 +1,589 @@
import flash.external.*;
function f2c_LeaveRoom()
{
ExternalInterface.call("f2c_LeaveRoom");
}
ExternalInterface.addCallback("c2f_LeaveRoom", this, c2f_LeaveRoom);
function c2f_LeaveRoom(resultCode:String):Void
{
if (resultCode=="REC_SUCCESS")
{
}
else
{
trace("c2f_LeaveRoom failure. Result= " + resultCode);
/*
REC_LEAVE_ROOM_UNKNOWN_ROOM_ID,
REC_LEAVE_ROOM_CURRENTLY_IN_QUICK_JOIN,
REC_LEAVE_ROOM_NOT_IN_ROOM,
*/
}
gotoAndStop("CreateRoom");
}
inviteFriendButton.addEventListener("click", this, "f2c_SendInvite");
function f2c_SendInvite()
{
ExternalInterface.call("f2c_SendInvite", playerNameTextInput.text,false);
}
ExternalInterface.addCallback("c2f_SendInvite", this, c2f_SendInvite);
function c2f_SendInvite(resultCode:String, inviteeName:String, inviteToSpectatorSlot:Boolean ):Void
{
if (resultCode=="REC_SUCCESS")
{
}
else
{
trace("c2f_SendInvite failure. Result= " + resultCode);
/*
REC_SEND_INVITE_UNKNOWN_ROOM_ID,
REC_SEND_INVITE_INVITEE_ALREADY_INVITED,
REC_SEND_INVITE_CANNOT_PERFORM_ON_SELF,
REC_SEND_INVITE_INVITOR_ONLY_MODERATOR_CAN_INVITE, // INVITE_MODE_MODERATOR_ONLY
REC_SEND_INVITE_INVITOR_LACK_INVITE_PERMISSIONS, // Any other INVITE_MODE
REC_SEND_INVITE_INVITOR_NOT_IN_ROOM,
REC_SEND_INVITE_NO_SLOTS,
REC_SEND_INVITE_INVITEE_ALREADY_IN_THIS_ROOM,
REC_SEND_INVITE_INVITEE_BANNED,
REC_SEND_INVITE_RECIPIENT_NOT_ONLINE,
REC_SEND_INVITE_ROOM_LOCKED,
*/
}
}
startSpectatingButton.addEventListener("click", this, "f2c_StartSpectating");
function f2c_StartSpectating()
{
ExternalInterface.call("f2c_StartSpectating");
}
ExternalInterface.addCallback("c2f_StartSpectating", this, c2f_StartSpectating);
function c2f_StartSpectating(resultCode:String):Void
{
if (resultCode=="REC_SUCCESS")
{
}
else
{
trace("c2f_StartSpectating failure. Result= " + resultCode);
/*
REC_START_SPECTATING_UNKNOWN_ROOM_ID,
REC_START_SPECTATING_ALREADY_SPECTATING,
REC_START_SPECTATING_NO_SPECTATOR_SLOTS_AVAILABLE,
REC_START_SPECTATING_NOT_IN_ROOM,
REC_START_SPECTATING_REASSIGN_MODERATOR_BEFORE_SPECTATE,
REC_START_SPECTATING_ROOM_LOCKED,
*/
}
}
stopSpectatingButton.addEventListener("click", this, "f2c_StopSpectating");
function f2c_StopSpectating()
{
ExternalInterface.call("f2c_StopSpectating");
}
ExternalInterface.addCallback("c2f_StopSpectating", this, c2f_StopSpectating);
function c2f_StopSpectating(resultCode:String):Void
{
if (resultCode=="REC_SUCCESS")
{
}
else
{
trace("c2f_StopSpectating failure. Result= " + resultCode);
/*
REC_STOP_SPECTATING_UNKNOWN_ROOM_ID,
REC_STOP_SPECTATING_NOT_IN_ROOM,
REC_STOP_SPECTATING_NOT_CURRENTLY_SPECTATING,
REC_STOP_SPECTATING_NO_SLOTS,
REC_STOP_SPECTATING_ROOM_LOCKED,
*/
}
}
makeModeratorButton.addEventListener("click", this, "f2c_GrantModerator");
function f2c_GrantModerator()
{
ExternalInterface.call("f2c_GrantModerator", playerNameTextInput.text);
}
ExternalInterface.addCallback("c2f_GrantModerator", this, c2f_GrantModerator);
function c2f_GrantModerator(resultCode:String, newModerator:String):Void
{
if (resultCode=="REC_SUCCESS")
{
}
else
{
trace("c2f_GrantModerator failure. Result= " + resultCode);
/*
REC_GRANT_MODERATOR_UNKNOWN_ROOM_ID,
REC_GRANT_MODERATOR_NEW_MODERATOR_NOT_ONLINE,
REC_GRANT_MODERATOR_NOT_IN_ROOM,
REC_GRANT_MODERATOR_NEW_MODERATOR_NOT_IN_ROOM,
REC_GRANT_MODERATOR_CANNOT_PERFORM_ON_SELF,
REC_GRANT_MODERATOR_MUST_BE_MODERATOR_TO_GRANT_MODERATOR,
REC_GRANT_MODERATOR_NEW_MODERATOR_NOT_IN_PLAYABLE_SLOT,
*/
}
}
readyButton.addEventListener("click", this, "f2c_SetReadyStatus_true");
unreadyButton.addEventListener("click", this, "f2c_SetReadyStatus_false");
function f2c_SetReadyStatus_true()
{
ExternalInterface.call("f2c_SetReadyStatus", true);
}
function f2c_SetReadyStatus_false()
{
ExternalInterface.call("f2c_SetReadyStatus", false);
}
ExternalInterface.addCallback("c2f_SetReadyStatus", this, c2f_SetReadyStatus);
function c2f_SetReadyStatus():Void
{
var resultCode:String = arguments[0];
if (resultCode=="REC_SUCCESS")
{
var isReady:Boolean = arguments[1];
var readyUsersListSize:Number = arguments[2];
var argumentIndex=3;
for (var i:Number = 0; i < roomMemberListSize; i++)
{
var userName:String = arguments[argumentIndex++];
}
var unreadyUsersListSize:Number = arguments[argumentIndex++];
for (var i:Number = 0; i < roomMemberListSize; i++)
{
var userName:String = arguments[argumentIndex++];
}
}
else
{
trace("c2f_SetReadyStatus failure. Result= " + resultCode);
/*
REC_SET_READY_STATUS_UNKNOWN_ROOM_ID,
REC_SET_READY_STATUS_NOT_IN_ROOM,
REC_SET_READY_STATUS_NOT_IN_PLAYABLE_SLOT,
REC_SET_READY_STATUS_AUTO_LOCK_ALL_PLAYERS_READY,
*/
}
}
function f2c_GetReadyStatus()
{
ExternalInterface.call("f2c_GetReadyStatus");
}
ExternalInterface.addCallback("c2f_GetReadyStatus", this, c2f_GetReadyStatus);
function c2f_GetReadyStatus(resultCode:String):Void
{
if (resultCode=="REC_SUCCESS")
{
var readyUsersListSize:Number = arguments[1];
var argumentIndex=2;
for (var i:Number = 0; i < roomMemberListSize; i++)
{
var userName:String = arguments[argumentIndex++];
}
var unreadyUsersListSize:Number = arguments[argumentIndex++];
for (var i:Number = 0; i < roomMemberListSize; i++)
{
var userName:String = arguments[argumentIndex++];
}
}
else
{
trace("c2f_GetReadyStatus failure. Result= " + resultCode);
/*
REC_GET_READY_STATUS_NOT_IN_ROOM,
REC_GET_READY_STATUS_UNKNOWN_ROOM_ID,
*/
}
}
lockRoomButton.addEventListener("click", this, "f2c_SetRoomLockState_Locked");
unlockRoomButton.addEventListener("click", this, "f2c_SetRoomLockState_Unlocked");
function f2c_SetRoomLockState_Locked()
{
// NOT_LOCKED
// PLAYERS_LOCKED
// ALL_LOCKED
ExternalInterface.call("f2c_SetRoomLockState", "ALL_LOCKED");
}
function f2c_SetRoomLockState_Unlocked()
{
// NOT_LOCKED
// PLAYERS_LOCKED
// ALL_LOCKED
ExternalInterface.call("f2c_SetRoomLockState", "NOT_LOCKED");
}
ExternalInterface.addCallback("c2f_SetRoomLockState", this, c2f_SetRoomLockState);
function c2f_SetRoomLockState(resultCode:String, roomLockState:String):Void
{
if (resultCode=="REC_SUCCESS")
{
if ( roomLockState=="NOT_LOCKED")
{
teamsAreLockedLabel.text="Not Locked";
}
else
{
teamsAreLockedLabel.text="Locked";
}
}
else
{
trace("c2f_SetRoomLockState failure. Result= " + resultCode);
/*
REC_SET_ROOM_LOCK_STATE_UNKNOWN_ROOM_ID,
REC_SET_ROOM_LOCK_STATE_NOT_IN_ROOM,
REC_SET_ROOM_LOCK_STATE_MUST_BE_MODERATOR,
REC_SET_ROOM_LOCK_STATE_BAD_ENUMERATION_VALUE,
*/
}
}
function f2c_GetRoomLockState()
{
ExternalInterface.call("f2c_GetRoomLockState");
}
ExternalInterface.addCallback("c2f_GetRoomLockState", this, c2f_GetRoomLockState);
function c2f_GetRoomLockState(resultCode:String, roomLockState:String):Void
{
if (resultCode=="REC_SUCCESS")
{
// NOT_LOCKED
// PLAYERS_LOCKED
// ALL_LOCKED
if ( roomLockState=="NOT_LOCKED")
{
teamsAreLockedLabel.text="Not Locked";
}
else
{
teamsAreLockedLabel.text="Locked";
}
}
else
{
trace("c2f_GetRoomLockState failure. Result= " + resultCode);
/*
REC_GET_ROOM_LOCK_STATE_UNKNOWN_ROOM_ID,
REC_GET_ROOM_LOCK_STATE_NOT_IN_ROOM,
*/
}
}
function f2c_AreAllMembersReady()
{
ExternalInterface.call("f2c_AreAllMembersReady");
}
ExternalInterface.addCallback("c2f_AreAllMembersReady", this, c2f_AreAllMembersReady);
function c2f_AreAllMembersReady(resultCode:String, allReady:Boolean):Void
{
if (resultCode=="REC_SUCCESS")
{
}
else
{
trace("c2f_AreAllMembersReady failure. Result= " + resultCode);
/*
REC_ARE_ALL_MEMBERS_READY_UNKNOWN_ROOM_ID,
REC_ARE_ALL_MEMBERS_READY_NOT_IN_ROOM,
*/
}
}
kickSelectedPlayerButton.addEventListener("click", this, "f2c_KickMember");
function f2c_KickMember()
{
var memberName:String = roomMembersScrollingList.dataProvider[roomMembersScrollingList.selectedIndex];
ExternalInterface.call("f2c_KickMember", memberName,"Reason goes here");
}
ExternalInterface.addCallback("c2f_KickMember", this, c2f_KickMember);
function c2f_KickMember(resultCode:String, kickedMember:String, reason:String):Void
{
if (resultCode=="REC_SUCCESS")
{
}
else
{
trace("c2f_KickMember failure. Result= " + resultCode);
/*
REC_KICK_MEMBER_UNKNOWN_ROOM_ID,
REC_KICK_MEMBER_NOT_IN_ROOM,
REC_KICK_MEMBER_TARGET_NOT_ONLINE,
REC_KICK_MEMBER_TARGET_NOT_IN_YOUR_ROOM,
REC_KICK_MEMBER_MUST_BE_MODERATOR,
REC_KICK_MEMBER_CANNOT_PERFORM_ON_SELF,
*/
}
}
sendChatMessageButton.addEventListener("click", this, "f2c_Room_Chat_Func");
function f2c_Room_Chat_Func()
{
ExternalInterface.call("f2c_Room_Chat_Func", chatTextInput.text);
}
ExternalInterface.addCallback("c2f_Chat_Callback", this, c2f_Chat_Callback);
function c2f_Chat_Callback(resultCode:String, chatRecipient:String, chatTextInput:String):Void
{
if (resultCode=="REC_SUCCESS")
{
trace(chatRecipient + " >> " + chatTextInput + "\n");
chatTextArea.text+=chatRecipient + " >> " + chatTextInput + "\n";
}
else
{
trace("c2f_Chat_Callback failure. Result= " + resultCode + " when sent to " + chatRecipient);
/*
REC_CHAT_USER_NOT_IN_ROOM,
REC_CHAT_RECIPIENT_NOT_ONLINE,
REC_CHAT_RECIPIENT_NOT_IN_ANY_ROOM,
REC_CHAT_RECIPIENT_NOT_IN_YOUR_ROOM,
*/
}
}
ExternalInterface.addCallback("c2f_Chat_Notification", this, c2f_Chat_Notification);
function c2f_Chat_Notification(sender:String, chatRecipient:String, chatTextInput:String, profanityFilteredTextInput:String ):Void
{
chatTextArea.text+=sender + " << " + chatTextInput + "\n";
}
startGameButton.addEventListener("click", this, "f2c_StartGame");
function f2c_StartGame()
{
ExternalInterface.call("f2c_StartGame");
}
ExternalInterface.addCallback("c2f_StartGame", this, c2f_StartGame);
function c2f_StartGame( resultCode:String ):Void
{
// Result of asking C++ to start the game
if (resultCode=="START_GAME_SUCCESS")
{
}
else
{
trace("c2f_StartGame failure. Result= " + resultCode);
/*
User defined codes here
*/
}
}
ExternalInterface.addCallback("c2f_StartGame_Notification", this, c2f_StartGame_Notification);
function c2f_StartGame_Notification( ):Void
{
// Tell actionscript that C++ start the game
}
ExternalInterface.addCallback("c2f_RoomMemberStartedSpectating_Callback", this, c2f_RoomMemberStartedSpectating_Callback)
function c2f_RoomMemberStartedSpectating_Callback( userName:String ):Void
{
}
ExternalInterface.addCallback("c2f_RoomMemberStoppedSpectating_Callback", this, c2f_RoomMemberStoppedSpectating_Callback)
function c2f_RoomMemberStoppedSpectating_Callback( userName:String ):Void
{
}
ExternalInterface.addCallback("c2f_ModeratorChanged_Callback", this, c2f_ModeratorChanged_Callback)
function c2f_ModeratorChanged_Callback( newModerator:String, oldModerator:String ):Void
{
}
ExternalInterface.addCallback("c2f_RoomMemberReadyStatusSet_Callback", this, c2f_RoomMemberReadyStatusSet_Callback)
function c2f_RoomMemberReadyStatusSet_Callback( ):Void
{
var isReady:Boolean = arguments[0];
var roomMemberName:String = arguments[1];
var num:Number = arguments[2];
var argumentIndex=3;
// users in the ready state
for (var i:Number = 0; i < num; i++)
{
var roomMemberName = arguments[argumentIndex++];
}
num = arguments[argumentIndex++];
// Users in the unready state
for (var i:Number = 0; i < num; i++)
{
var roomMemberName = arguments[argumentIndex++];
}
}
ExternalInterface.addCallback("c2f_RoomLockStateSet_Callback", this, c2f_RoomLockStateSet_Callback)
function c2f_RoomLockStateSet_Callback( roomLockState:String ):Void
{
// NOT_LOCKED
// PLAYERS_LOCKED
// ALL_LOCKED
if ( roomLockState=="NOT_LOCKED")
{
teamsAreLockedLabel.text="Not Locked";
}
else
{
teamsAreLockedLabel.text="Locked";
}
}
function RemoveFromRoomMembersList(roomMember:String)
{
for (var i:Number = 0; i < roomMembersScrollingList.dataProvider.length; i++)
{
var memberName:String = roomMembersScrollingList.dataProvider[i];
if (memberName==roomMember)
{
roomMembersScrollingList.splice(i,1);
break;
}
}
}
function AddToRoomMembersList(roomMember:String)
{
for (var i:Number = 0; i < roomMembersScrollingList.dataProvider.length; i++)
{
var memberName:String = roomMembersScrollingList.dataProvider[i];
if (memberName==roomMember)
{
return;
}
}
roomMembersScrollingList.dataProvider.push(roomMember);
roomMembersScrollingList.dataProvider.invalidate();
}
ExternalInterface.addCallback("c2f_RoomMemberKicked_Callback", this, c2f_RoomMemberKicked_Callback)
function c2f_RoomMemberKicked_Callback( roomMember:String, moderator:String, reason:String ):Void
{
RemoveFromRoomMembersList(roomMember);
}
ExternalInterface.addCallback("c2f_RoomMemberLeftRoom_Callback", this, c2f_RoomMemberLeftRoom_Callback)
function c2f_RoomMemberLeftRoom_Callback( roomMember:String ):Void
{
RemoveFromRoomMembersList(roomMember);
}
ExternalInterface.addCallback("c2f_RoomMemberJoinedRoom_Callback", this,c2f_RoomMemberJoinedRoom_Callback)
function c2f_RoomMemberJoinedRoom_Callback( acceptedInvitorName:String, acceptedInvitorAddress:String, joiningMemberName:String, joiningMemberAddress:String ):Void
{
AddToRoomMembersList(joiningMemberName);
}
ExternalInterface.addCallback("c2f_RoomDestroyedOnModeratorLeft_Callback", this, c2f_RoomDestroyedOnModeratorLeft_Callback)
function c2f_RoomDestroyedOnModeratorLeft_Callback( oldModerator:String ):Void
{
trace("The room was destroyed.");
gotoAndStop("CreateRoom");
}
function f2c_GetRoomProperties()
{
ExternalInterface.call("f2c_GetRoomProperties");
}
ExternalInterface.addCallback("c2f_GetRoomProperties", this, c2f_GetRoomProperties)
function c2f_GetRoomProperties( ):Void
{
var resultCode:String = arguments[0];
if (resultCode=="REC_SUCCESS")
{
roomMembersScrollingList.dataProvider=[];
var roomName:String = arguments[1];
var roomMemberListSize:Number = arguments[2];
var argumentIndex=3;
for (var i:Number = 0; i < roomMemberListSize; i++)
{
var roomMemberName:String = arguments[argumentIndex++];
// RMM_MODERATOR
// RMM_PUBLIC
// RMM_RESERVED
// RMM_SPECTATOR_PUBLIC
// RMM_SPECTATOR_RESERVED
// RMM_ANY_PLAYABLE
// RMM_ANY_SPECTATOR
var roomMemberMode:String = arguments[argumentIndex++];
var roomMemberIsReady:Boolean = arguments[argumentIndex++];
var roomMemberAddress:String = arguments[argumentIndex++];
var roomMemberGuid:String = arguments[argumentIndex++];
roomMembersScrollingList.dataProvider.push(roomMemberName);
}
roomMembersScrollingList.dataProvider.invalidate();
var banListSize:Number = arguments[argumentIndex++];
for (var i:Number = 0; i < banListSize; i++)
{
var roomMemberName:String = arguments[argumentIndex++];
var reason:String = arguments[argumentIndex++];
}
// NOT_LOCKED
// PLAYERS_LOCKED
// ALL_LOCKED
var roomLockState:String = arguments[argumentIndex++];
var roomId:Number = arguments[argumentIndex++];
var automaticallyLockRoomWhenAllUsersAreReady:Boolean = arguments[argumentIndex++];
var roomIsHiddenFromSearches:Boolean = arguments[argumentIndex++];
// For both inviteToRoomPermission and inviteToSpectatorSlotPermission
// INVITE_MODE_ANYONE_CAN_INVITE,
// INVITE_MODE_MODERATOR_CAN_INVITE,
// INVITE_MODE_PUBLIC_SLOTS_CAN_INVITE,
// INVITE_MODE_RESERVED_SLOTS_CAN_INVITE,
// INVITE_MODE_SPECTATOR_SLOTS_CAN_INVITE,
// INVITE_MODE_MODERATOR_OR_PUBLIC_SLOTS_CAN_INVITE,
// INVITE_MODE_MODERATOR_OR_PUBLIC_OR_RESERVED_SLOTS_CAN_INVITE,
var inviteToRoomPermission:String = arguments[argumentIndex++];
var inviteToSpectatorSlotPermission:String = arguments[argumentIndex++];
roomNameLabel.text=roomName;
if ( roomLockState=="NOT_LOCKED")
{
teamsAreLockedLabel.text="Not Locked";
}
else
{
teamsAreLockedLabel.text="Locked";
}
}
else
{
trace("c2f_GetRoomProperties failure. Result= " + resultCode);
/*
REC_GET_ROOM_PROPERTIES_EMPTY_ROOM_NAME_AND_NOT_IN_A_ROOM,
REC_GET_ROOM_PROPERTIES_UNKNOWN_ROOM_NAME,
*/
}
}
f2c_GetRoomProperties();

View File

@ -0,0 +1,8 @@
import flash.external.*;
returnToTitleButton.addEventListener("click", this, "ReturnToTitle");
function ReturnToTitle()
{
// Disconnect from the server
ExternalInterface.call("f2c_Logoff");
}

View File

@ -0,0 +1,346 @@
import flash.external.*;
updateButton.addEventListener("click", this, "UpdateRoomsList");
function UpdateRoomsList()
{
var isNetUpdate:Boolean = netRadioButton.selected;
lobbyRoomsScrollingList.dataProvider=[];
ExternalInterface.call("f2c_UpdateRoomsList", isNetUpdate);
// If the platform requires friends in the scaleform UI, this will update it.
ExternalInterface.call("f2c_QueryPlatform","c2f_QueryPlatform_Lobby_Callback");
}
netRadioButton.addEventListener("click", this, "UpdateRoomsList");
lanRadioButton.addEventListener("click", this, "UpdateRoomsList");
joinRoomButton.addEventListener("click", this, "JoinRoom");
function JoinRoom()
{
// 0th element is the unique room id, used as a search flag for when joining a room
// How do I tell if lobbyRoomsScrollingList has a selection active?
ExternalInterface.call("f2c_JoinByFilter",
Boolean(lobbyRoomsScrollingList.dataProvider[lobbyRoomsScrollingList.selectedIndex][0]), // isFromNetwork
Number(lobbyRoomsScrollingList.dataProvider[lobbyRoomsScrollingList.selectedIndex][1]), // guid
String(lobbyRoomsScrollingList.dataProvider[lobbyRoomsScrollingList.selectedIndex][2]) // IP address
);
}
ExternalInterface.addCallback("c2f_JoinByFilter", this, c2f_JoinByFilter);
function c2f_JoinByFilter( resultCode:String ):Void
{
if (resultCode=="REC_SUCCESS")
gotoAndStop("inRoom");
else
{
trace("c2f_JoinByFilter failure. Result= " + resultCode);
/*
REC_JOIN_BY_FILTER_UNKNOWN_TITLE,
REC_JOIN_BY_FILTER_NO_ROOMS,
REC_JOIN_BY_FILTER_CURRENTLY_IN_A_ROOM,
REC_JOIN_BY_FILTER_CURRENTLY_IN_QUICK_JOIN,
REC_JOIN_BY_FILTER_CANNOT_JOIN_AS_MODERATOR,
REC_JOIN_BY_FILTER_ROOM_LOCKED,
REC_JOIN_BY_FILTER_BANNED,
REC_JOIN_BY_FILTER_NO_SLOTS,
*/
}
}
createRoomButton.addEventListener("click", this, "CreateRoom");
function CreateRoom()
{
gotoAndStop("CreateRoom");
}
manageFriendsButton.addEventListener("click", this, "ManageFriends");
function ManageFriends()
{
gotoAndStop("ManageFriends_PC");
}
logoffButton.addEventListener("click", this, "Logoff");
function Logoff()
{
ExternalInterface.call("f2c_Logoff");
}
chatTextInput.addEventListener("textChange", this, "UpdateSendButton");
chatRecipient.addEventListener("textChange", this, "UpdateSendButton");
function UpdateSendButton()
{
if (chatTextInput.text.length>0 && chatRecipient.text.length>0)
sendChatButton.enabled=true;
else
sendChatButton.enabled=false;
}
sendChatButton.addEventListener("click", this, "Chat_Func");
function Chat_Func()
{
if (chatTextInput.text.length>0 && chatRecipient.text.length>0)
{
ExternalInterface.call("f2c_Directed_Chat_Func", chatRecipient.text, chatTextInput.text);
}
}
ExternalInterface.addCallback("c2f_Chat_Callback", this, c2f_Chat_Callback);
function c2f_Chat_Callback(resultCode:String, chatRecipient:String, chatTextInput:String):Void
{
if (resultCode=="REC_SUCCESS")
{
chatTextArea.text+=chatRecipient + " >> " + chatTextInput + "\n";
}
else
{
trace("c2f_Chat_Callback failure. Result= " + resultCode + " when sent to " + chatRecipient);
/*
REC_CHAT_USER_NOT_IN_ROOM,
REC_CHAT_RECIPIENT_NOT_ONLINE,
REC_CHAT_RECIPIENT_NOT_IN_ANY_ROOM,
REC_CHAT_RECIPIENT_NOT_IN_YOUR_ROOM,
*/
}
}
ExternalInterface.addCallback("c2f_Chat_Notification", this, c2f_Chat_Notification);
function c2f_Chat_Notification(sender:String, chatRecipient:String, chatTextInput:String, profanityFilteredTextInput:String ):Void
{
chatTextArea.text+=sender + " << " + chatTextInput + "\n";
}
ExternalInterface.addCallback("c2f_Client_Logoff", this, c2f_Client_Logoff);
function c2f_Client_Logoff(resultCode:String):Void
{
gotoAndStop("Main");
}
function UpdateFriendsList()
{
lobbyFriendsScrollingList.dataProvider=[];
ExternalInterface.call("f2c_UpdateFriendsList");
}
function c2f_QueryPlatform_Lobby_Callback(platform:String):Void
{
if (platform=="RakNet")
{
UpdateFriendsList();
}
else
{
// This stuff is handled thought internal menus on the XBOX 360 and PS3
friendsStatusLabel.visible=false;
lobbyFriendsScrollingList.visible=false;
lobbyFriendsScrollBar.visible=false;
manageFriendsButton.visible=false;
chatTextArea.visible=false;
sendChatButton.visible=false;
chatLabel1.visible=false;
chatLabel2.visible=false;
chatRecipient.visible=false;
chatTextInput.visible=false;
chatScrollBar.visible=false;
// Only NET on the XBOX 360 and PS3
netRadioButton.visible=false;
lanRadioButton.visible=false;
}
}
ExternalInterface.addCallback("c2f_AddSingleRoom", this, c2f_AddSingleRoom);
function c2f_AddSingleRoom():Void
{
var roomIsFromServer = arguments[0];
var roomId:Number = arguments[1];
var ipAddrAndPort:String = arguments[2];
var roomName:String = arguments[3];
var numRoomMembers:Number = arguments[4];
var maxRoomMembers:Number = arguments[5];
var mapName:String = arguments[6];
lobbyRoomsScrollingList.dataProvider.push([roomIsFromServer,roomId,ipAddrAndPort,roomName,numRoomMembers,maxRoomMembers,mapName]);
lobbyRoomsScrollingList.dataProvider.invalidate();
}
ExternalInterface.addCallback("c2f_SearchByFilter_Callback", this, c2f_SearchByFilter_Callback);
function c2f_SearchByFilter_Callback():Void
{
// push statements below do not work unless I clear the list first. I don't know why though.
lobbyRoomsScrollingList.dataProvider=[];
var resultCode:String = arguments[0];
if (resultCode=="REC_SUCCESS")
{
var num:Number = arguments[1];
var startingIdx:Number=2;
for (var i:Number = 0; i < num; i++)
{
var roomIsFromServer = arguments[startingIdx+i*7+0];
var roomId:Number = arguments[startingIdx+i*7+1];
var ipAddrAndPort:String = arguments[startingIdx+i*7+2];
var roomName:String = arguments[startingIdx+i*7+3];
var numRoomMembers:Number = arguments[startingIdx+i*7+4];
var maxRoomMembers:Number = arguments[startingIdx+i*7+5];
var mapName:String = arguments[startingIdx+i*7+6];
lobbyRoomsScrollingList.dataProvider.push([roomIsFromServer,roomId,ipAddrAndPort,roomName,numRoomMembers,maxRoomMembers,mapName]);
lobbyRoomsScrollingList.dataProvider.invalidate();
}
}
else
{
// Unknown title (Programmer error).
trace(resultCode);
// REC_SEARCH_BY_FILTER_UNKNOWN_TITLE,
}
}
ExternalInterface.addCallback("c2f_Friends_GetInvites", this, c2f_Friends_GetInvites);
function c2f_Friends_GetInvites():Void
{
var resultCode:String = arguments[0];
if (resultCode=="L2RC_SUCCESS")
{
var num:Number = arguments[1];
var startingIdx:Number=2;
// Invites received
for (var i:Number = 0; i < num; i++)
{
// params are same as c2f_Friends_GetFriends
var handle:String = arguments[startingIdx+i*5+0];
var isOnline:Boolean = arguments[startingIdx+i*5+1];
var isVisible:Boolean = arguments[startingIdx+i*5+2];
var loggedInTitle:String = arguments[startingIdx+i*5+3];
var status:String = arguments[startingIdx+i*5+4];
lobbyFriendsScrollingList.dataProvider.push(["Got invitation", handle,isOnline,isVisible,loggedInTitle,status]);
}
// Invites sent
startingIdx+=num*5;
num=arguments[startingIdx++];
for (var i:Number = 0; i < num; i++)
{
// params are same as c2f_Friends_GetFriends
var handle:String = arguments[startingIdx+i*5+0];
var isOnline:Boolean = arguments[startingIdx+i*5+1];
var isVisible:Boolean = arguments[startingIdx+i*5+2];
var loggedInTitle:String = arguments[startingIdx+i*5+3];
var status:String = arguments[startingIdx+i*5+4];
lobbyFriendsScrollingList.dataProvider.push(["Sent invitation", handle,isOnline,isVisible,loggedInTitle,status]);
}
lobbyFriendsScrollingList.dataProvider.invalidate();
}
else
{
// For RakNet, cannot fail
trace(resultCode);
}
}
ExternalInterface.addCallback("c2f_Friends_GetFriends", this, c2f_Friends_GetFriends);
function c2f_Friends_GetFriends():Void
{
var resultCode:String = arguments[0];
if (resultCode=="L2RC_SUCCESS")
{
var num:Number = arguments[1];
var startingIdx:Number=2;
for (var i:Number = 0; i < num; i++)
{
// params are same as c2f_Friends_GetInvites
var handle:String = arguments[startingIdx+i*5+0];
var isOnline:Boolean = arguments[startingIdx+i*5+1];
var isVisible:Boolean = arguments[startingIdx+i*5+2];
var loggedInTitle:String = arguments[startingIdx+i*5+3];
var status:String = arguments[startingIdx+i*5+4];
lobbyFriendsScrollingList.dataProvider.push(["Is a friend", handle,isOnline,isVisible,loggedInTitle,status]);
lobbyFriendsScrollingList.dataProvider.invalidate();
}
}
else
{
// For RakNet, cannot fail
trace(resultCode);
}
}
ExternalInterface.addCallback("c2f_Notification_Friends_PresenceUpdate", this, c2f_Notification_Friends_PresenceUpdate);
function c2f_Notification_Friends_PresenceUpdate(otherHandle:String, onlineStatusSetToVisible:Boolean, loggedInTitle:String, status:String):Void
{
trace("c2f_Notification_Friends_PresenceUpdate, " + otherHandle + ", " + onlineStatusSetToVisible + ", " + loggedInTitle + ", " + status);
// Update the friends list if the platform requires it
ExternalInterface.call("f2c_QueryPlatform","c2f_QueryPlatform_Lobby_Callback");
}
// LAN connection attempt failed
ExternalInterface.addCallback("c2f_NotifyFailedConnectionAttempt", this, c2f_NotifyFailedConnectionAttempt);
function c2f_NotifyFailedConnectionAttempt(resultCode:String, systemAddress:String):Void
{
// Result codes are:
// CONNECTION_ATTEMPT_FAILED
// ALREADY_CONNECTED
// NO_FREE_INCOMING_CONNECTIONS
// RSA_PUBLIC_KEY_MISMATCH
// CONNECTION_BANNED
// INVALID_PASSWORD
trace(resultCode);
gotoAndStop("Main");
}
ExternalInterface.addCallback("c2f_NotifyNewConnection", this, c2f_NotifyNewConnection);
function c2f_NotifyNewConnection(systemAddress:String, rakNetGuid:String, isIncoming:Boolean):Void
{
trace("c2f_NotifyNewConnection, " + systemAddress + ", " + rakNetGuid + ", " + isIncoming);
// Connecting at this stage must be through the LAN
gotoAndStop("InGame");
}
ExternalInterface.addCallback("c2f_Notification_Friends_StatusChange", this, c2f_Notification_Friends_StatusChange);
function c2f_Notification_Friends_StatusChange(operation:String, otherHandle:String, onlineStatusSetToVisible:Boolean, loggedInTitle:String, status:String):Void
{
// operation can be:
// FRIEND_LOGGED_IN,
// FRIEND_LOGGED_OFF,
// FRIEND_ACCOUNT_WAS_DELETED,
// YOU_WERE_REMOVED_AS_A_FRIEND,
// GOT_INVITATION_TO_BE_FRIENDS,
// THEY_ACCEPTED_OUR_INVITATION_TO_BE_FRIENDS,
// THEY_REJECTED_OUR_INVITATION_TO_BE_FRIENDS,
trace("c2f_Notification_Friends_StatusChange, " + operation + ", " + otherHandle + ", " + onlineStatusSetToVisible + ", " + loggedInTitle + ", " + status);
// If the platform requires friends in the scaleform UI, this will update it.
ExternalInterface.call("f2c_QueryPlatform","c2f_QueryPlatform_Lobby_Callback");
}
ExternalInterface.addCallback("c2f_RoomInvitationSent_Callback", this, c2f_RoomInvitationSent_Callback)
function c2f_RoomInvitationSent_Callback( invitorName:String, inviteToSpectatorSlot:Boolean ):Void
{
trace("You got a room invitation from " + invitorName);
}
ExternalInterface.addCallback("c2f_RoomInvitationWithdrawn_Callback", this, c2f_RoomInvitationWithdrawn_Callback)
function c2f_RoomInvitationWithdrawn_Callback( invitorName:String, invitorAddress:String ):Void
{
trace("Your room invitation was withdrawn from " + invitorName);
}
sendChatButton.enabled=false;
netRadioButton.selected=true;
UpdateRoomsList();
stop();

View File

@ -0,0 +1,20 @@
import flash.external.*;
startButton.addEventListener("click", this, "Start");
ExternalInterface.addCallback("c2f_QueryPlatform_Main_Callback", this, c2f_QueryPlatform_Main_Callback);
function Start()
{
ExternalInterface.call("f2c_QueryPlatform","c2f_QueryPlatform_Main_Callback");
}
function c2f_QueryPlatform_Main_Callback(platform:String):Void
{
if (platform=="RakNet")
{
gotoAndStop("connectToServer_RakNet");
}
}
stop();

View File

@ -0,0 +1,108 @@
import flash.external.*;
sendInviteButton.addEventListener("click", this, "Friends_SendInvite");
function Friends_SendInvite()
{
ExternalInterface.call("f2c_Friends_SendInvite", usernameTextInput.text);
}
ExternalInterface.addCallback("c2f_Friends_SendInvite", this, c2f_Friends_SendInvite);
function c2f_Friends_SendInvite(resultCode:String, userHandle:String):Void
{
if (resultCode=="L2RC_SUCCESS")
{
trace("c2f_Friends_SendInvite success, " + userHandle);
}
else
{
// L2RC_Friends_SendInvite_UNKNOWN_TARGET_HANDLE
// L2RC_Friends_SendInvite_CANNOT_PERFORM_ON_SELF
// L2RC_DATABASE_CONSTRAINT_FAILURE
// L2RC_Friends_SendInvite_ALREADY_SENT_INVITE
// L2RC_Friends_SendInvite_ALREADY_FRIENDS
trace(resultCode);
}
}
removeButton.addEventListener("click", this, "Friends_Remove");
function Friends_Remove()
{
ExternalInterface.call("f2c_Friends_Remove", usernameTextInput.text);
}
ExternalInterface.addCallback("c2f_Friends_Remove", this, c2f_Friends_Remove);
function c2f_Friends_Remove(resultCode:String, targetHandle:String):Void
{
if (resultCode=="L2RC_SUCCESS")
{
trace("c2f_Friends_Remove success, " + targetHandle);
}
else
{
// L2RC_Friends_Remove_UNKNOWN_TARGET_HANDLE
// L2RC_Friends_Remove_CANNOT_PERFORM_ON_SELF
// L2RC_DATABASE_CONSTRAINT_FAILURE
// L2RC_Friends_Remove_NOT_FRIENDS
trace(resultCode);
}
}
acceptInviteButton.addEventListener("click", this, "Friends_AcceptInvite");
function Friends_AcceptInvite( )
{
ExternalInterface.call("f2c_Friends_AcceptInvite", usernameTextInput.text);
}
ExternalInterface.addCallback("c2f_Friends_AcceptInvite", this, c2f_Friends_AcceptInvite);
function c2f_Friends_AcceptInvite(resultCode:String, userHandle:String, onlineStatusSetToVisible:Boolean, loggedInTitle:String, status:String):Void
{
if (resultCode=="L2RC_SUCCESS")
{
trace("c2f_Friends_AcceptInvite success, " + userHandle + ", " + onlineStatusSetToVisible + ", " + loggedInTitle + ", " + status);
}
else
{
// L2RC_Friends_AcceptInvite_UNKNOWN_TARGET_HANDLE
// L2RC_Friends_AcceptInvite_CANNOT_PERFORM_ON_SELF
// L2RC_DATABASE_CONSTRAINT_FAILURE
// L2RC_Friends_AcceptInvite_NO_INVITE
trace(resultCode);
}
}
rejectInviteButton.addEventListener("click", this, "Friends_RejectInvite");
function Friends_RejectInvite()
{
ExternalInterface.call("f2c_Friends_RejectInvite", usernameTextInput.text);
}
ExternalInterface.addCallback("c2f_Friends_RejectInvite", this, c2f_Friends_RejectInvite);
function c2f_Friends_RejectInvite(resultCode:String, targetHandle:String):Void
{
if (resultCode=="L2RC_SUCCESS")
{
trace("c2f_Friends_RejectInvite success, " + targetHandle);
}
else
{
// L2RC_Friends_RejectInvite_UNKNOWN_TARGET_HANDLE
// L2RC_Friends_RejectInvite_CANNOT_PERFORM_ON_SELF
// L2RC_DATABASE_CONSTRAINT_FAILURE
// L2RC_Friends_RejectInvite_NO_INVITE
trace(resultCode);
}
}
backButton.addEventListener("click", this, "BackToLobby");
function BackToLobby()
{
gotoAndStop("Lobby");
}
stop();

View File

@ -0,0 +1,70 @@
/*
* Original work: Copyright (c) 2014, Oculus VR, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* RakNet License.txt file in the licenses directory of this source tree. An additional grant
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
*
*
* Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
*
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
* license found in the license.txt file in the root directory of this source tree.
*/
#include "RoomsBrowserGFx3.h"
RoomsBrowserGFx3::RoomsBrowserGFx3()
{
}
RoomsBrowserGFx3::~RoomsBrowserGFx3()
{
}
void RoomsBrowserGFx3::Init(GPtr<FxDelegate> pDelegate, GPtr<GFxMovieView> pMovie)
{
pDelegate->RegisterHandler(this);
delegate=pDelegate;
movie=pMovie;
}
void RoomsBrowserGFx3::Shutdown(void)
{
if (delegate.GetPtr()!=0)
{
delegate->UnregisterHandler(this);
delegate.Clear();
}
movie.Clear();
}
ACTIONSCRIPT_CALLABLE_FUNCTION(RoomsBrowserGFx3, f2c_QueryPlatform)
{
FxResponseArgs<1> rargs;
rargs.Add(QueryPlatform());
// pparams.Respond(rargs);
FxDelegate::Invoke2(movie, pparams[0].GetString(), rargs);
}
ACTIONSCRIPT_CALLABLE_FUNCTION(RoomsBrowserGFx3, f2c_SaveProperty)
{
SaveProperty(pparams[0].GetString(), pparams[1].GetString());
}
ACTIONSCRIPT_CALLABLE_FUNCTION(RoomsBrowserGFx3, f2c_LoadProperty)
{
SLNet::RakString propertyOut;
LoadProperty(pparams[0].GetString(), propertyOut);
FxResponseArgs<1> rargs;
rargs.Add(propertyOut.C_String());
// pparams.Respond(rargs);
FxDelegate::Invoke2(movie, pparams[1].GetString(), rargs);
}
void RoomsBrowserGFx3::Accept(CallbackProcessor* cbreg)
{
cbreg->Process( "f2c_QueryPlatform", &::f2c_QueryPlatform );
cbreg->Process( "f2c_SaveProperty", &::f2c_SaveProperty );
cbreg->Process( "f2c_LoadProperty", &::f2c_LoadProperty );
}

View File

@ -0,0 +1,54 @@
/*
* Original work: Copyright (c) 2014, Oculus VR, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* RakNet License.txt file in the licenses directory of this source tree. An additional grant
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
*
*
* Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
*
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
* license found in the license.txt file in the root directory of this source tree.
*/
#include "slikenet/WindowsIncludes.h"
#include "FxGameDelegate.h"
#include "slikenet/string.h"
#define ACTIONSCRIPT_CALLABLE_HEADER(functionName) virtual void functionName(const FxDelegateArgs& pparams);
#define ACTIONSCRIPT_CALLABLE_FUNCTION(className, functionName) \
void functionName(const FxDelegateArgs& pparams) \
{ \
((className*)pparams.GetHandler())->functionName(pparams); \
} \
void className::functionName(const FxDelegateArgs& pparams)
// GFxPlayerTinyD3D9.cpp has an instance of this class, and callls the corresponding 3 function
// This keeps the patching code out of the GFx sample as much as possible
class RoomsBrowserGFx3 : public FxDelegateHandler
{
public:
RoomsBrowserGFx3();
virtual ~RoomsBrowserGFx3();
virtual void Init(GPtr<FxDelegate> pDelegate, GPtr<GFxMovieView> pMovie);
// Update all callbacks from flash
void Accept(CallbackProcessor* cbreg);
void Shutdown(void);
virtual const char *QueryPlatform(void) const=0;
virtual void SaveProperty(const char *propertyId, const char *propertyValue)=0;
virtual void LoadProperty(const char *propertyId, SLNet::RakString &propertyOut)=0;
// Calls from Flash
ACTIONSCRIPT_CALLABLE_HEADER(f2c_QueryPlatform);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_SaveProperty);
ACTIONSCRIPT_CALLABLE_HEADER(f2c_LoadProperty);
GPtr<FxDelegate> delegate;
GPtr<GFxMovieView> movie;
};