instance form and pve
This commit is contained in:
parent
b5b2e95f34
commit
621676732d
@ -160,7 +160,7 @@ svg {
|
|||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cryps input {
|
.cryps input, .cryps select {
|
||||||
border-color: #444;
|
border-color: #444;
|
||||||
background-color: #333;
|
background-color: #333;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
@ -286,6 +286,10 @@ header {
|
|||||||
margin-right: 0.5em;
|
margin-right: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.create-form button {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
INSTANCE
|
INSTANCE
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -15,6 +15,11 @@ const addState = connect(
|
|||||||
ws.clearGameStateTimeout();
|
ws.clearGameStateTimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!instance) {
|
||||||
|
ws.clearInstanceStateTimeout();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return { game, instance, account };
|
return { game, instance, account };
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -7,6 +7,8 @@ const { stringSort } = require('./../utils');
|
|||||||
const molecule = require('./molecule');
|
const molecule = require('./molecule');
|
||||||
const SpawnButton = require('./spawn.button');
|
const SpawnButton = require('./spawn.button');
|
||||||
|
|
||||||
|
const InstanceCreateForm = require('./instance.create.form');
|
||||||
|
|
||||||
const idSort = stringSort('id');
|
const idSort = stringSort('id');
|
||||||
|
|
||||||
const COLOURS = [
|
const COLOURS = [
|
||||||
@ -24,7 +26,6 @@ function Menu(args) {
|
|||||||
sendInstanceState,
|
sendInstanceState,
|
||||||
sendPlayerMmCrypsSet,
|
sendPlayerMmCrypsSet,
|
||||||
sendInstanceJoin,
|
sendInstanceJoin,
|
||||||
sendInstanceNew,
|
|
||||||
sendCrypSpawn,
|
sendCrypSpawn,
|
||||||
instances,
|
instances,
|
||||||
} = args;
|
} = args;
|
||||||
@ -64,20 +65,12 @@ function Menu(args) {
|
|||||||
Set Matchmaking Team
|
Set Matchmaking Team
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
const instanceJoin = (
|
|
||||||
<button
|
|
||||||
className={`menu-instance-btn right ${instanceJoinHidden ? 'hidden' : ''}`}
|
|
||||||
disabled={instanceJoinHidden}
|
|
||||||
onClick={() => sendInstanceNew()}>
|
|
||||||
Create New Instance
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="menu-instance-list" >
|
<section className="menu-instance-list" >
|
||||||
{instancePanels}
|
{instancePanels}
|
||||||
{mmSet}
|
{mmSet}
|
||||||
{instanceJoin}
|
<InstanceCreateForm />
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,13 +14,6 @@ const addState = connect(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendInstanceNew() {
|
|
||||||
if (selectedCryps.length) {
|
|
||||||
return ws.sendInstanceNew(selectedCryps);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendPlayerMmCrypsSet() {
|
function sendPlayerMmCrypsSet() {
|
||||||
if (selectedCryps.length) {
|
if (selectedCryps.length) {
|
||||||
return ws.sendPlayerMmCrypsSet(selectedCryps);
|
return ws.sendPlayerMmCrypsSet(selectedCryps);
|
||||||
@ -41,7 +34,6 @@ const addState = connect(
|
|||||||
cryps,
|
cryps,
|
||||||
selectedCryps,
|
selectedCryps,
|
||||||
sendInstanceJoin,
|
sendInstanceJoin,
|
||||||
sendInstanceNew,
|
|
||||||
sendInstanceState,
|
sendInstanceState,
|
||||||
sendCrypSpawn,
|
sendCrypSpawn,
|
||||||
sendPlayerMmCrypsSet,
|
sendPlayerMmCrypsSet,
|
||||||
|
|||||||
@ -20,6 +20,9 @@ function registerEvents(store) {
|
|||||||
|
|
||||||
function setGame(game) {
|
function setGame(game) {
|
||||||
const { game: currentGame, ws } = store.getState();
|
const { game: currentGame, ws } = store.getState();
|
||||||
|
|
||||||
|
if (!game) ws.clearGameStateTimeout();
|
||||||
|
|
||||||
if (game && currentGame) {
|
if (game && currentGame) {
|
||||||
if (game.resolved.length !== currentGame.resolved.length) {
|
if (game.resolved.length !== currentGame.resolved.length) {
|
||||||
// stop fetching the game state til animations are done
|
// stop fetching the game state til animations are done
|
||||||
|
|||||||
@ -148,8 +148,8 @@ function createSocket(events) {
|
|||||||
send({ method: 'instance_join', params: { instance_id: instanceId, cryp_ids: cryps } });
|
send({ method: 'instance_join', params: { instance_id: instanceId, cryp_ids: cryps } });
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendInstanceNew(cryps) {
|
function sendInstanceNew(cryps, name, players) {
|
||||||
send({ method: 'instance_new', params: { cryp_ids: cryps, name: 'dota pros onli', players: 2 } });
|
send({ method: 'instance_new', params: { cryp_ids: cryps, name, players } });
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendInstanceReady(instanceId) {
|
function sendInstanceReady(instanceId) {
|
||||||
@ -323,6 +323,7 @@ function createSocket(events) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
clearGameStateTimeout,
|
clearGameStateTimeout,
|
||||||
|
clearInstanceStateTimeout,
|
||||||
sendAccountLogin,
|
sendAccountLogin,
|
||||||
sendAccountCreate,
|
sendAccountCreate,
|
||||||
sendAccountDemo,
|
sendAccountDemo,
|
||||||
|
|||||||
@ -537,9 +537,15 @@ pub fn instance_get_open(tx: &mut Transaction) -> Result<Instance, Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn instance_new(params: InstanceLobbyParams, tx: &mut Transaction, account: &Account) -> Result<Instance, Error> {
|
pub fn instance_new(params: InstanceLobbyParams, tx: &mut Transaction, account: &Account) -> Result<Instance, Error> {
|
||||||
let mut instance = Instance::new()
|
let mut instance = match params.players {
|
||||||
|
1 => Instance::new()
|
||||||
|
.set_max_players(16)?
|
||||||
|
.set_name(params.name)?
|
||||||
|
.add_bots(),
|
||||||
|
_ => Instance::new()
|
||||||
.set_max_players(params.players)?
|
.set_max_players(params.players)?
|
||||||
.set_name(params.name)?;
|
.set_name(params.name)?,
|
||||||
|
};
|
||||||
|
|
||||||
instance = instance_create(tx, instance)?;
|
instance = instance_create(tx, instance)?;
|
||||||
let join_params = InstanceJoinParams { instance_id: instance.id, cryp_ids: params.cryp_ids };
|
let join_params = InstanceJoinParams { instance_id: instance.id, cryp_ids: params.cryp_ids };
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user