Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Tablexia-old
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
10
Issues
10
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
labs
Tablexia-old
Commits
86d3532e
Commit
86d3532e
authored
Dec 08, 2014
by
Luboš Horáček
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'devel' of gitlab.labs.nic.cz:labs/tablexia into devel
parents
ac81c9b6
73191f5e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
120 additions
and
31 deletions
+120
-31
obb/potme/gfx/actions/dog.png
obb/potme/gfx/actions/dog.png
+0
-0
obb/potme/gfx/control/start_button_blinker.png
obb/potme/gfx/control/start_button_blinker.png
+0
-0
obb/potme/gfx/info/start_arrow_blinker.png
obb/potme/gfx/info/start_arrow_blinker.png
+0
-0
src/main/java/cz/nic/tablexia/game/games/potme/PotmeActivity.java
.../java/cz/nic/tablexia/game/games/potme/PotmeActivity.java
+34
-0
src/main/java/cz/nic/tablexia/game/games/potme/ResourceManager.java
...ava/cz/nic/tablexia/game/games/potme/ResourceManager.java
+4
-0
src/main/java/cz/nic/tablexia/game/games/potme/action/widget/ActionsWidget.java
...ablexia/game/games/potme/action/widget/ActionsWidget.java
+82
-31
No files found.
obb/potme/gfx/actions/dog.png
View replaced file @
ac81c9b6
View file @
86d3532e
7.38 KB
|
W:
|
H:
10.3 KB
|
W:
|
H:
2-up
Swipe
Onion skin
obb/potme/gfx/control/start_button_blinker.png
0 → 100644
View file @
86d3532e
5.35 KB
obb/potme/gfx/info/start_arrow_blinker.png
0 → 100644
View file @
86d3532e
41.3 KB
src/main/java/cz/nic/tablexia/game/games/potme/PotmeActivity.java
View file @
86d3532e
...
...
@@ -33,7 +33,11 @@ import org.andengine.entity.Entity;
import
org.andengine.entity.IEntity
;
import
org.andengine.entity.modifier.AlphaModifier
;
import
org.andengine.entity.modifier.DelayModifier
;
import
org.andengine.entity.modifier.FadeInModifier
;
import
org.andengine.entity.modifier.FadeOutModifier
;
import
org.andengine.entity.modifier.LoopEntityModifier
;
import
org.andengine.entity.modifier.MoveModifier
;
import
org.andengine.entity.modifier.SequenceEntityModifier
;
import
org.andengine.entity.primitive.Rectangle
;
import
org.andengine.entity.scene.Scene
;
import
org.andengine.entity.scene.background.Background
;
...
...
@@ -213,6 +217,7 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
private
boolean
enabled
=
true
;
private
Entity
backgroundLayer
;
private
Entity
blinkerLayer
;
private
Entity
textLayer
;
private
Rectangle
touchArea
;
...
...
@@ -221,6 +226,7 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
private
Sprite
unpressedButtonSprite
;
private
Sprite
disabledButtonSprite
;
private
Sprite
blinkerButtonSprite
;
private
Text
buttonText
;
private
float
textUnpressedPositionX
;
...
...
@@ -228,17 +234,25 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
private
float
textPressedPositionX
;
private
float
textPressedPositionY
;
private
LoopEntityModifier
blinkerModifier
;
public
StartButton
(
VertexBufferObjectManager
vertexBufferObject
)
{
// layers
backgroundLayer
=
new
Entity
();
blinkerLayer
=
new
Entity
();
textLayer
=
new
Entity
();
attachChild
(
backgroundLayer
);
attachChild
(
blinkerLayer
);
attachChild
(
textLayer
);
// backgrounds
unpressedButtonSprite
=
new
Sprite
(
0
,
0
,
ResourceManager
.
getInstance
().
getTexture
(
ResourceManager
.
CONTROL_START_UNPRESSED
),
vertexBufferObject
);
disabledButtonSprite
=
new
Sprite
(
0
,
0
,
ResourceManager
.
getInstance
().
getTexture
(
ResourceManager
.
CONTROL_START_DISABLED
),
vertexBufferObject
);
blinkerButtonSprite
=
new
Sprite
(
0
,
0
,
ResourceManager
.
getInstance
().
getTexture
(
ResourceManager
.
CONTROL_START_BLINKER
),
vertexBufferObject
);
disablePulsing
();
blinkerLayer
.
attachChild
(
blinkerButtonSprite
);
// touch area
touchArea
=
new
Rectangle
(
0
,
0
,
unpressedButtonSprite
.
getWidth
(),
unpressedButtonSprite
.
getHeight
(),
vertexBufferObject
)
{
...
...
@@ -273,11 +287,31 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
}
public
void
disable
()
{
disablePulsing
();
enabled
=
false
;
changeActualButtonSprite
(
disabledButtonSprite
);
buttonText
.
setPosition
(
textPressedPositionX
,
textPressedPositionY
);
}
public
void
enablePulsing
()
{
FadeInModifier
fadeIn
=
new
FadeInModifier
(
1
f
);
fadeIn
.
setAutoUnregisterWhenFinished
(
true
);
FadeOutModifier
fadeOut
=
new
FadeOutModifier
(
1
f
);
fadeOut
.
setAutoUnregisterWhenFinished
(
true
);
SequenceEntityModifier
sequenceModifier
=
new
SequenceEntityModifier
(
fadeOut
,
fadeIn
);
sequenceModifier
.
setAutoUnregisterWhenFinished
(
true
);
blinkerModifier
=
new
LoopEntityModifier
(
sequenceModifier
);
blinkerButtonSprite
.
registerEntityModifier
(
blinkerModifier
);
}
public
void
disablePulsing
()
{
if
(
blinkerModifier
!=
null
)
{
blinkerButtonSprite
.
unregisterEntityModifier
(
blinkerModifier
);
blinkerModifier
=
null
;
}
blinkerButtonSprite
.
setAlpha
(
0
);
}
public
boolean
isEnbleda
()
{
return
enabled
;
}
...
...
src/main/java/cz/nic/tablexia/game/games/potme/ResourceManager.java
View file @
86d3532e
...
...
@@ -84,6 +84,7 @@ public class ResourceManager {
public
static
final
String
CONTROL_NEXT
=
ASSET_CONTROL
+
"next.png"
;
public
static
final
String
CONTROL_START_UNPRESSED
=
ASSET_CONTROL
+
"start_button_unpressed.png"
;
public
static
final
String
CONTROL_START_DISABLED
=
ASSET_CONTROL
+
"start_button_disabled.png"
;
public
static
final
String
CONTROL_START_BLINKER
=
ASSET_CONTROL
+
"start_button_blinker.png"
;
public
static
final
String
CONTROL_ACTUAL
=
ASSET_CONTROL
+
"actual.png"
;
public
static
final
String
CONTROL_KEY
=
ASSET_CONTROL
+
"key_icon.png"
;
...
...
@@ -103,6 +104,7 @@ public class ResourceManager {
public
static
final
String
INFO_SAFE1
=
ASSET_INFO
+
"safe1.png"
;
public
static
final
String
INFO_SAFE2
=
ASSET_INFO
+
"safe2.png"
;
public
static
final
String
INFO_START_ARROW
=
ASSET_INFO
+
"start_arrow.png"
;
public
static
final
String
INFO_START_ARROW_BLINKER
=
ASSET_INFO
+
"start_arrow_blinker.png"
;
private
static
final
String
ASSET_SFX_SOURCE
=
ASSET_GAME
+
"sfx/"
;
...
...
@@ -205,6 +207,7 @@ public class ResourceManager {
loadTexture
(
engine
,
context
,
CONTROL_NEXT
);
loadTexture
(
engine
,
context
,
CONTROL_START_UNPRESSED
);
loadTexture
(
engine
,
context
,
CONTROL_START_DISABLED
);
loadTexture
(
engine
,
context
,
CONTROL_START_BLINKER
);
loadTexture
(
engine
,
context
,
CONTROL_ACTUAL
);
loadTexture
(
engine
,
context
,
CONTROL_KEY
);
...
...
@@ -221,6 +224,7 @@ public class ResourceManager {
loadTexture
(
engine
,
context
,
INFO_SAFE1
);
loadTexture
(
engine
,
context
,
INFO_SAFE2
);
loadTexture
(
engine
,
context
,
INFO_START_ARROW
);
loadTexture
(
engine
,
context
,
INFO_START_ARROW_BLINKER
);
SoundFactory
.
setAssetBasePath
(
ASSET_SFX_SOURCE
);
...
...
src/main/java/cz/nic/tablexia/game/games/potme/action/widget/ActionsWidget.java
View file @
86d3532e
...
...
@@ -24,14 +24,21 @@ import java.util.List;
import
org.andengine.entity.Entity
;
import
org.andengine.entity.IEntity
;
import
org.andengine.entity.modifier.DelayModifier
;
import
org.andengine.entity.modifier.FadeInModifier
;
import
org.andengine.entity.modifier.FadeOutModifier
;
import
org.andengine.entity.modifier.LoopEntityModifier
;
import
org.andengine.entity.modifier.SequenceEntityModifier
;
import
org.andengine.entity.primitive.Rectangle
;
import
org.andengine.entity.scene.Scene
;
import
org.andengine.entity.sprite.Sprite
;
import
org.andengine.opengl.texture.region.ITextureRegion
;
import
org.andengine.opengl.vbo.VertexBufferObjectManager
;
import
org.andengine.util.adt.color.Color
;
import
org.andengine.util.modifier.IModifier
;
import
android.os.Handler
;
import
cz.nic.tablexia.game.common.EntityModifierListenerAdapter
;
import
cz.nic.tablexia.game.games.potme.PotmeActivity
;
import
cz.nic.tablexia.game.games.potme.PotmeActivity.StartButton
;
import
cz.nic.tablexia.game.games.potme.PotmeDifficulty
;
...
...
@@ -83,16 +90,20 @@ public class ActionsWidget extends Entity implements ActionListener {
}
}
private
static
final
int
TOP_Z_INDEX
=
ActionType
.
values
().
length
+
1
;
private
static
final
float
BACKGROUND_WIDTH_RATIO
=
1.3f
;
private
static
final
double
BACKGROUND_Y_POSITION_RATIO
=
0.9
;
private
static
final
int
START_ANIMATION_DELAY
=
200
;
private
static
final
int
NUMBER_OF_COLUMNS
=
2
;
public
static
final
int
ACTION_OFFSET
=
PotmeActivity
.
ACTION_SIZE_SMALLER
/
10
;
private
static
final
float
DIMMER_ALPHA
=
0.5f
;
private
static
final
Color
DIMMER_COLOR
=
Color
.
BLACK
;
private
static
final
float
START_ARROW_WIDTH
=
PotmeActivity
.
TILE_SIZE
*
1.2f
;
private
static
final
float
START_ARROW_HEIGHT
=
PotmeActivity
.
TILE_SIZE
;
private
static
final
float
TUTORIAL_INFO_ARROW_BLINK_DURATION
=
1
f
;
private
static
final
float
TUTORIAL_INFO_ARROW_FADEIN_DELAY
=
0.5f
;
private
static
final
int
TOP_Z_INDEX
=
ActionType
.
values
().
length
+
1
;
private
static
final
float
BACKGROUND_WIDTH_RATIO
=
1.3f
;
private
static
final
double
BACKGROUND_Y_POSITION_RATIO
=
0.9
;
private
static
final
int
START_ANIMATION_DELAY
=
200
;
private
static
final
int
NUMBER_OF_COLUMNS
=
2
;
public
static
final
int
ACTION_OFFSET
=
PotmeActivity
.
ACTION_SIZE_SMALLER
/
10
;
private
static
final
float
DIMMER_ALPHA
=
0.5f
;
private
static
final
Color
DIMMER_COLOR
=
Color
.
BLACK
;
private
static
final
float
START_ARROW_X_OFFSET
=
PotmeActivity
.
ACTION_SIZE_SMALLER
*
1.3f
;
private
static
final
int
START_ARROW_Y_OFFSET
=
PotmeActivity
.
ACTION_SIZE_SMALLER
/
2
;
private
static
final
float
START_ARROW_WIDTH
=
PotmeActivity
.
TILE_SIZE
*
1.5f
;
private
static
final
float
START_ARROW_HEIGHT
=
PotmeActivity
.
TILE_SIZE
;
private
ActionsStripWidget
actionsStripWidget
;
private
List
<
Action
>
actions
;
...
...
@@ -153,8 +164,7 @@ public class ActionsWidget extends Entity implements ActionListener {
}
ActionLayer
.
ACTIONS_LAYER
.
getLayerEntity
().
attachChild
(
dimmer
);
ActionLayer
.
BACKGROUND_LAYER
.
getLayerEntity
().
attachChild
(
actionsBackground
);
tryToPerformNextTutorialStep
();
tryDimmAllActions
();
}
public
void
setStartButton
(
StartButton
startButton
)
{
...
...
@@ -201,13 +211,21 @@ public class ActionsWidget extends Entity implements ActionListener {
},
actualDelay
);
actualDelay
=
actualDelay
+
START_ANIMATION_DELAY
;
}
(
new
Handler
()).
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
tryToPerformNextTutorialStep
();
}
},
actualDelay
+
START_ANIMATION_DELAY
);
}
/* //////////////////////////////////////////// ACTION STATE */
public
void
enableActions
()
{
if
(
potmeDifficulty
!=
PotmeDifficulty
.
TUTORIAL
)
{
if
(
potmeDifficulty
!=
PotmeDifficulty
.
TUTORIAL
)
{
for
(
Action
action
:
actions
)
{
action
.
enable
();
}
...
...
@@ -251,13 +269,11 @@ public class ActionsWidget extends Entity implements ActionListener {
if
(
potmeDifficulty
==
PotmeDifficulty
.
TUTORIAL
)
{
if
(
currentStepNumber
<
PotmeActivity
.
TUTORIAL_STEPS
.
size
())
{
highliteAction
(
PotmeActivity
.
TUTORIAL_STEPS
.
get
(
currentStepNumber
));
if
(
startButton
!=
null
)
{
startButton
.
disable
();
}
}
else
{
PotmeActivity
.
GameLayer
.
BUTTON_LAYER
.
sendToFront
(
scene
);
if
(
startButton
!=
null
)
{
if
(
startButton
!=
null
)
{
startButton
.
enable
();
startButton
.
enablePulsing
();
}
}
}
else
{
...
...
@@ -265,19 +281,21 @@ public class ActionsWidget extends Entity implements ActionListener {
}
}
private
void
dimmAllActions
()
{
dimmer
.
setVisible
(
true
);
for
(
Action
action
:
actions
)
{
action
.
setZIndex
(
action
.
getOrderNumber
());
action
.
disable
();
private
void
tryDimmAllActions
()
{
if
(
potmeDifficulty
==
PotmeDifficulty
.
TUTORIAL
)
{
dimmer
.
setVisible
(
true
);
for
(
Action
action
:
actions
)
{
action
.
setZIndex
(
action
.
getOrderNumber
());
action
.
disable
();
}
dimmer
.
setZIndex
(
actions
.
size
());
ActionLayer
.
ACTIONS_LAYER
.
getLayerEntity
().
sortChildren
();
}
dimmer
.
setZIndex
(
actions
.
size
());
ActionLayer
.
ACTIONS_LAYER
.
getLayerEntity
().
sortChildren
();
}
private
void
highliteAction
(
ActionType
actionType
)
{
if
(
actionType
.
ordinal
()
<
actions
.
size
())
{
d
immAllActions
();
tryD
immAllActions
();
Action
action
=
actions
.
get
(
actionType
.
ordinal
());
action
.
setZIndex
(
TOP_Z_INDEX
);
action
.
enable
();
...
...
@@ -288,13 +306,46 @@ public class ActionsWidget extends Entity implements ActionListener {
private
void
showArrowSprite
(
float
positionX
,
float
positionY
,
VertexBufferObjectManager
vertexBufferObjectManager
)
{
hideArrowSprite
();
Sprite
infoArrowSprite
=
new
Sprite
(
positionX
+
(
PotmeActivity
.
ACTION_SIZE_SMALLER
*
1.2f
),
positionY
-
(
PotmeActivity
.
ACTION_SIZE_SMALLER
/
2
),
START_ARROW_WIDTH
,
START_ARROW_HEIGHT
,
ResourceManager
.
getInstance
().
getTexture
(
ResourceManager
.
INFO_START_ARROW
),
vertexBufferObjectManager
);
final
Sprite
infoArrowSprite
=
new
Sprite
(
positionX
+
START_ARROW_X_OFFSET
,
positionY
-
START_ARROW_Y_OFFSET
,
START_ARROW_WIDTH
,
START_ARROW_HEIGHT
,
ResourceManager
.
getInstance
().
getTexture
(
ResourceManager
.
INFO_START_ARROW
),
vertexBufferObjectManager
);
final
Sprite
infoArrowBlinkerSprite
=
new
Sprite
(
positionX
+
START_ARROW_X_OFFSET
,
positionY
-
START_ARROW_Y_OFFSET
,
START_ARROW_WIDTH
,
START_ARROW_HEIGHT
,
ResourceManager
.
getInstance
().
getTexture
(
ResourceManager
.
INFO_START_ARROW_BLINKER
),
vertexBufferObjectManager
);
infoArrowSprite
.
setAlpha
(
0
);
infoArrowBlinkerSprite
.
setAlpha
(
0
);
ActionLayer
.
INFO_LAYER
.
getLayerEntity
().
attachChild
(
infoArrowSprite
);
ActionLayer
.
INFO_LAYER
.
getLayerEntity
().
attachChild
(
infoArrowBlinkerSprite
);
FadeInModifier
fadeIn
=
new
FadeInModifier
(
TUTORIAL_INFO_ARROW_BLINK_DURATION
);
fadeIn
.
setAutoUnregisterWhenFinished
(
true
);
FadeOutModifier
fadeOut
=
new
FadeOutModifier
(
TUTORIAL_INFO_ARROW_BLINK_DURATION
);
fadeOut
.
setAutoUnregisterWhenFinished
(
true
);
final
SequenceEntityModifier
sequenceModifier
=
new
SequenceEntityModifier
(
fadeIn
,
fadeOut
);
sequenceModifier
.
setAutoUnregisterWhenFinished
(
true
);
DelayModifier
delayModifier
=
new
DelayModifier
(
TUTORIAL_INFO_ARROW_FADEIN_DELAY
);
delayModifier
.
setAutoUnregisterWhenFinished
(
true
);
delayModifier
.
addModifierListener
(
new
EntityModifierListenerAdapter
()
{
@Override
public
void
onModifierFinished
(
IModifier
<
IEntity
>
pModifier
,
IEntity
pItem
)
{
FadeInModifier
fadeInModifier
=
new
FadeInModifier
(
TUTORIAL_INFO_ARROW_FADEIN_DELAY
);
fadeInModifier
.
setAutoUnregisterWhenFinished
(
true
);
infoArrowSprite
.
registerEntityModifier
(
fadeInModifier
);
infoArrowBlinkerSprite
.
registerEntityModifier
(
new
LoopEntityModifier
(
sequenceModifier
));
}
});
infoArrowSprite
.
registerEntityModifier
(
delayModifier
);
}
private
void
hideArrowSprite
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment