|
@@ -37,8 +37,13 @@ import com.example.tfat.myapplication.navigationbar.RecordFinishView
|
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
import io.reactivex.schedulers.Schedulers
|
|
import io.reactivex.schedulers.Schedulers
|
|
import kotlinx.android.synthetic.main.layer_management_fragment.*
|
|
import kotlinx.android.synthetic.main.layer_management_fragment.*
|
|
|
|
+import kotlinx.android.synthetic.main.popupview_opacity_dialog.view.*
|
|
import kotlinx.android.synthetic.main.view_control_dialogue_dialog.view.*
|
|
import kotlinx.android.synthetic.main.view_control_dialogue_dialog.view.*
|
|
import java.util.concurrent.CopyOnWriteArrayList
|
|
import java.util.concurrent.CopyOnWriteArrayList
|
|
|
|
+import android.widget.SeekBar
|
|
|
|
+import com.bomostory.sceneeditmodule.DialogueColorData
|
|
|
|
+import kotlinx.android.synthetic.main.popupview_color_dialog.view.*
|
|
|
|
+
|
|
|
|
|
|
class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener, EditActorView.OnActorChangeListener,
|
|
class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener, EditActorView.OnActorChangeListener,
|
|
OnTouchBoMoSceneListener.OnSceneMoveListener, DialogInterface.OnDismissListener, FileUtils.OnSaveActorImage,
|
|
OnTouchBoMoSceneListener.OnSceneMoveListener, DialogInterface.OnDismissListener, FileUtils.OnSaveActorImage,
|
|
@@ -60,8 +65,8 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
companion object {
|
|
companion object {
|
|
const val PHOTO_FROM_GALLERY = 1
|
|
const val PHOTO_FROM_GALLERY = 1
|
|
const val LAYER_MANAGEMENT = "layer_management"
|
|
const val LAYER_MANAGEMENT = "layer_management"
|
|
- const val ACTOR_HEIGHT = 200
|
|
|
|
- const val ACTOR_WIDTH = 200
|
|
|
|
|
|
+ const val ACTOR_HEIGHT = 400
|
|
|
|
+ const val ACTOR_WIDTH = 400
|
|
const val DIALOGUE_HEIGHT = 320
|
|
const val DIALOGUE_HEIGHT = 320
|
|
const val DIALOGUE_WIDTH = 400
|
|
const val DIALOGUE_WIDTH = 400
|
|
const val ACTOR_INIT_POSITION_X = 200
|
|
const val ACTOR_INIT_POSITION_X = 200
|
|
@@ -574,6 +579,8 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
dialog.parentLayerIndex = currentLayerIndex
|
|
dialog.parentLayerIndex = currentLayerIndex
|
|
dialog.isMovable = true
|
|
dialog.isMovable = true
|
|
dialog.isDialogue = true
|
|
dialog.isDialogue = true
|
|
|
|
+ dialog.dialogType = DialogueColorData.getDialogColorType(resource).first
|
|
|
|
+ dialog.dialogColor = DialogueColorData.getDialogColorType(resource).second
|
|
it[currentSceneIndex].layers[currentLayerIndex].actors.add(dialog)
|
|
it[currentSceneIndex].layers[currentLayerIndex].actors.add(dialog)
|
|
sceneEditView.scene = it[currentSceneIndex]
|
|
sceneEditView.scene = it[currentSceneIndex]
|
|
}
|
|
}
|
|
@@ -627,7 +634,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
sceneEditView.setLayerVisible(currentLayerIndex)
|
|
sceneEditView.setLayerVisible(currentLayerIndex)
|
|
var popupWindow = PopupWindow(this)
|
|
var popupWindow = PopupWindow(this)
|
|
popupWindow.contentView = when(actor.isDialogue) { true -> createDialogPopupView(actor, popupWindow)
|
|
popupWindow.contentView = when(actor.isDialogue) { true -> createDialogPopupView(actor, popupWindow)
|
|
- false -> createActorPopupView(actor, popupWindow)}
|
|
|
|
|
|
+ false -> createActorPopupView(actor, popupWindow)}
|
|
popupWindow.width = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
popupWindow.width = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
popupWindow.height = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
popupWindow.height = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
popupWindow.isOutsideTouchable = true
|
|
popupWindow.isOutsideTouchable = true
|
|
@@ -656,6 +663,46 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ popupView.opacity.setOnClickListener {
|
|
|
|
+ popupWindow.dismiss()
|
|
|
|
+ var popupWindow = PopupWindow(this)
|
|
|
|
+ var popupView = LayoutInflater.from(this).inflate(R.layout.popupview_opacity_dialog, null)
|
|
|
|
+ popupWindow.contentView = popupView
|
|
|
|
+ popupWindow.width = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
|
+ popupWindow.height = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
|
+ popupWindow.isOutsideTouchable = false
|
|
|
|
+ popupWindow.showAtLocation(sceneEditView, Gravity.START,actor.positionX,0)
|
|
|
|
+ popupView.sb_opacity_dialog_opacity.progress = (actor.opacity * 100).toInt()
|
|
|
|
+ popupView.tv_opacity_dialog_opacity.text = "Opacity : " + (actor.opacity * 100).toInt().toString() + "%"
|
|
|
|
+ popupView.sb_opacity_dialog_opacity.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
|
|
|
|
+ override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {
|
|
|
|
+ popupView.tv_opacity_dialog_opacity.text = "Opacity : " + p1.toString() + "%"
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].opacity = p1.toFloat().div(100)
|
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ override fun onStartTrackingTouch(p0: SeekBar?) {
|
|
|
|
+ }
|
|
|
|
+ override fun onStopTrackingTouch(p0: SeekBar?) {
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ popupView.tv_opacity_dialog_ok.setOnClickListener {
|
|
|
|
+ popupWindow.dismiss()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ popupView.Mirror.setOnClickListener {
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].isMirror =
|
|
|
|
+ !it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].isMirror
|
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
|
+ popupWindow.dismiss()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
popupView.bring_to_front.setOnClickListener{
|
|
popupView.bring_to_front.setOnClickListener{
|
|
project.story?.let {
|
|
project.story?.let {
|
|
it.scenes?.let {
|
|
it.scenes?.let {
|
|
@@ -719,6 +766,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
textColor = actor.textColor
|
|
textColor = actor.textColor
|
|
textAlign = actor.textAlign
|
|
textAlign = actor.textAlign
|
|
isDialogue = actor.isDialogue
|
|
isDialogue = actor.isDialogue
|
|
|
|
+ opacity = actor.opacity
|
|
}
|
|
}
|
|
it[currentSceneIndex].layers[currentLayerIndex].actors.add(actorData)
|
|
it[currentSceneIndex].layers[currentLayerIndex].actors.add(actorData)
|
|
setActorPositionZ(it[currentSceneIndex].layers[currentLayerIndex].actors)
|
|
setActorPositionZ(it[currentSceneIndex].layers[currentLayerIndex].actors)
|
|
@@ -727,6 +775,106 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ popupView.Mirror_dialogue.setOnClickListener {
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].isMirror =
|
|
|
|
+ !it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].isMirror
|
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
|
+ popupWindow.dismiss()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ popupView.layout_dialogue_dialog_color.setOnClickListener {
|
|
|
|
+ popupWindow.dismiss()
|
|
|
|
+ var popupWindow = PopupWindow(this)
|
|
|
|
+ var popupView = LayoutInflater.from(this).inflate(R.layout.popupview_color_dialog, null)
|
|
|
|
+ when (actor.dialogColor){
|
|
|
|
+ 0 -> popupView.iv_dialogue_set_color_white.setImageResource(R.drawable.ic_done)
|
|
|
|
+ 1 -> popupView.iv_dialogue_set_color_yellow.setImageResource(R.drawable.ic_done)
|
|
|
|
+ 2 -> popupView.iv_dialogue_set_color_blue.setImageResource(R.drawable.ic_done)
|
|
|
|
+ 3 -> popupView.iv_dialogue_set_color_green.setImageResource(R.drawable.ic_done)
|
|
|
|
+ 4 -> popupView.iv_dialogue_set_color_orange.setImageResource(R.drawable.ic_done)
|
|
|
|
+ }
|
|
|
|
+ popupView.iv_dialogue_set_color_white.setOnClickListener {
|
|
|
|
+ popupView.iv_dialogue_set_color_white.setImageResource(R.drawable.ic_done)
|
|
|
|
+ popupView.iv_dialogue_set_color_blue.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_yellow.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_green.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_orange.setImageDrawable(null)
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].resourcePath = DialogueColorData.dialogMap[Pair(actor.dialogType,0)].toString()
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].dialogColor = 0
|
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ popupView.iv_dialogue_set_color_blue.setOnClickListener {
|
|
|
|
+ popupView.iv_dialogue_set_color_white.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_blue.setImageResource(R.drawable.ic_done)
|
|
|
|
+ popupView.iv_dialogue_set_color_yellow.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_green.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_orange.setImageDrawable(null)
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].resourcePath = DialogueColorData.dialogMap[Pair(actor.dialogType,2)].toString()
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].dialogColor = 2
|
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ popupView.iv_dialogue_set_color_yellow.setOnClickListener {
|
|
|
|
+ popupView.iv_dialogue_set_color_white.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_blue.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_yellow.setImageResource(R.drawable.ic_done)
|
|
|
|
+ popupView.iv_dialogue_set_color_green.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_orange.setImageDrawable(null)
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].resourcePath = DialogueColorData.dialogMap[Pair(actor.dialogType,1)].toString()
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].dialogColor = 1
|
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ popupView.iv_dialogue_set_color_green.setOnClickListener {
|
|
|
|
+ popupView.iv_dialogue_set_color_white.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_blue.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_yellow.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_green.setImageResource(R.drawable.ic_done)
|
|
|
|
+ popupView.iv_dialogue_set_color_orange.setImageDrawable(null)
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].resourcePath = DialogueColorData.dialogMap[Pair(actor.dialogType,3)].toString()
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].dialogColor = 3
|
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ popupView.iv_dialogue_set_color_orange.setOnClickListener {
|
|
|
|
+ popupView.iv_dialogue_set_color_white.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_blue.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_yellow.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_green.setImageDrawable(null)
|
|
|
|
+ popupView.iv_dialogue_set_color_orange.setImageResource(R.drawable.ic_done)
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].resourcePath = DialogueColorData.dialogMap[Pair(actor.dialogType,4)].toString()
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].dialogColor = 4
|
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ popupView.tv_color_dialog_ok.setOnClickListener {
|
|
|
|
+ popupWindow.dismiss()
|
|
|
|
+ }
|
|
|
|
+ popupWindow.width = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
|
+ popupWindow.height = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
|
+ popupWindow.contentView = popupView
|
|
|
|
+ popupWindow.isOutsideTouchable = false
|
|
|
|
+ popupWindow.showAtLocation(sceneEditView, Gravity.START,actor.positionX,0)
|
|
|
|
+ }
|
|
popupView.bring_to_front_dialogue.setOnClickListener{
|
|
popupView.bring_to_front_dialogue.setOnClickListener{
|
|
project.story?.let {
|
|
project.story?.let {
|
|
it.scenes?.let {
|
|
it.scenes?.let {
|
|
@@ -864,7 +1012,6 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
}
|
|
}
|
|
|
|
|
|
override fun onLayerManagementDialog(layerNum: Int, position: Int) {
|
|
override fun onLayerManagementDialog(layerNum: Int, position: Int) {
|
|
- //var actor = Actor()
|
|
|
|
val selectLayer = layerNum - 1
|
|
val selectLayer = layerNum - 1
|
|
project.story?.let {
|
|
project.story?.let {
|
|
it.scenes?.let {
|
|
it.scenes?.let {
|