|
@@ -181,6 +181,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
initRecord()
|
|
initRecord()
|
|
|
|
+ initCurrentState()
|
|
}
|
|
}
|
|
|
|
|
|
override fun onResume() {
|
|
override fun onResume() {
|
|
@@ -244,6 +245,28 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
}
|
|
}
|
|
themeName = project.themeAssetIndex.name
|
|
themeName = project.themeAssetIndex.name
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private fun initCurrentState(){
|
|
|
|
+ val currentScene = intent.getIntExtra("currentScene",0)
|
|
|
|
+ val currentLayer = intent.getIntExtra("currentLayer",6)
|
|
|
|
+ var oldSceneIndex = currentSceneIndex
|
|
|
|
+ currentSceneIndex = currentScene
|
|
|
|
+ switchToPreViewLayer()
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let{
|
|
|
|
+ sceneEditView.scene = it[currentScene]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ record = Record()
|
|
|
|
+ initControlBarView()
|
|
|
|
+ initNavigationBarView(oldSceneIndex)
|
|
|
|
+ initPreviousNextButton()
|
|
|
|
+ switchLayer(currentLayer)
|
|
|
|
+ if(intent.getBooleanExtra("is_from_choose_theme",false)) {
|
|
|
|
+ themeName = intent.getStringExtra("theme_name")
|
|
|
|
+ initActorRecyclerView()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
private fun initControlBarView() {
|
|
private fun initControlBarView() {
|
|
controlBarView.setBtnSelected(6)
|
|
controlBarView.setBtnSelected(6)
|
|
switchToPreViewLayer()
|
|
switchToPreViewLayer()
|
|
@@ -1476,8 +1499,10 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
popupView.bring_to_front.setOnClickListener{
|
|
popupView.bring_to_front.setOnClickListener{
|
|
project.story?.let {
|
|
project.story?.let {
|
|
it.scenes?.let {
|
|
it.scenes?.let {
|
|
- it[currentSceneIndex].layers[currentLayerIndex].actors.removeAt(actor.positionZ)
|
|
|
|
- it[currentSceneIndex].layers[currentLayerIndex].actors.add(actor)
|
|
|
|
|
|
+ if(actor.positionZ + 1 < it[currentSceneIndex].layers[currentLayerIndex].actors.size) {
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors.removeAt(actor.positionZ)
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors.add(actor.positionZ + 1, actor)
|
|
|
|
+ }
|
|
setActorPositionZ(it[currentSceneIndex].layers[currentLayerIndex].actors)
|
|
setActorPositionZ(it[currentSceneIndex].layers[currentLayerIndex].actors)
|
|
sceneEditView.scene = it[currentSceneIndex]
|
|
sceneEditView.scene = it[currentSceneIndex]
|
|
popupWindow.dismiss()
|
|
popupWindow.dismiss()
|
|
@@ -1488,8 +1513,10 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
popupView.send_to_back.setOnClickListener{
|
|
popupView.send_to_back.setOnClickListener{
|
|
project.story?.let {
|
|
project.story?.let {
|
|
it.scenes?.let {
|
|
it.scenes?.let {
|
|
- it[currentSceneIndex].layers[currentLayerIndex].actors.remove(actor)
|
|
|
|
- it[currentSceneIndex].layers[currentLayerIndex].actors.add(0, actor)
|
|
|
|
|
|
+ if(actor.positionZ - 1 >= 0) {
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors.removeAt(actor.positionZ)
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors.add(actor.positionZ - 1, actor)
|
|
|
|
+ }
|
|
setActorPositionZ(it[currentSceneIndex].layers[currentLayerIndex].actors)
|
|
setActorPositionZ(it[currentSceneIndex].layers[currentLayerIndex].actors)
|
|
sceneEditView.scene = it[currentSceneIndex]
|
|
sceneEditView.scene = it[currentSceneIndex]
|
|
popupWindow.dismiss()
|
|
popupWindow.dismiss()
|
|
@@ -1802,7 +1829,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
}
|
|
}
|
|
|
|
|
|
override fun onSceneMove(dX: Int) {
|
|
override fun onSceneMove(dX: Int) {
|
|
- if ( (BACKGROUND_MOVE_RATE * monitorSize.widthPixels.div(BACKGROUND_MOVE_RATE * 2)) >= (swipeX + dX) && (swipeX + dX) > (-(BACKGROUND_MOVE_RATE * monitorSize.widthPixels.div(BACKGROUND_MOVE_RATE * 2)))) {
|
|
|
|
|
|
+ if ( (BACKGROUND_MOVE_RATE * monitorSize.widthPixels.div(BACKGROUND_MOVE_RATE * 4)) >= (swipeX + dX) && (swipeX + dX) > (-(BACKGROUND_MOVE_RATE * monitorSize.widthPixels.div(BACKGROUND_MOVE_RATE * 4)))) {
|
|
sceneEditView.x = swipeX + dX
|
|
sceneEditView.x = swipeX + dX
|
|
if (isRecord) {
|
|
if (isRecord) {
|
|
record?.tracks.let {
|
|
record?.tracks.let {
|
|
@@ -2132,6 +2159,8 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
val intent = Intent(this@SceneEditActivity, ChooseThemeActivity::class.java).apply {
|
|
val intent = Intent(this@SceneEditActivity, ChooseThemeActivity::class.java).apply {
|
|
putExtra("project", json)
|
|
putExtra("project", json)
|
|
putExtra("other_theme", themeJson)
|
|
putExtra("other_theme", themeJson)
|
|
|
|
+ putExtra("currentScene",currentSceneIndex)
|
|
|
|
+ putExtra("currentLayer",currentLayerIndex)
|
|
}
|
|
}
|
|
startActivity(intent)
|
|
startActivity(intent)
|
|
finish()
|
|
finish()
|