|
@@ -41,8 +41,10 @@ import java.util.concurrent.CopyOnWriteArrayList
|
|
|
import android.widget.SeekBar
|
|
|
import com.bomostory.sceneeditmodule.DialogueColorData
|
|
|
import com.bomostory.sceneeditmodule.SceneDrawer
|
|
|
+import com.bomostory.sceneeditmodule.navigationbar.actor.ObjectView
|
|
|
import com.bomostory.sceneeditmodule.navigationbar.brush.BrushView
|
|
|
import com.bomostory.sceneeditmodule.screen.view.*
|
|
|
+import kotlinx.android.synthetic.main.actor_select_view.view.*
|
|
|
import kotlinx.android.synthetic.main.movie_item_view.*
|
|
|
import kotlinx.android.synthetic.main.navigation_bar_view.view.*
|
|
|
import kotlinx.android.synthetic.main.popupview_color_dialog.view.*
|
|
@@ -65,6 +67,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
private var record = Record()
|
|
|
private var resourceThemeBitmap = ArrayList<String>()
|
|
|
private var resourceActorBitmap = ArrayList<ArrayList<String>>()
|
|
|
+ private var resourceObjectPath = ArrayList<String>()
|
|
|
private lateinit var sceneAdapter: SceneAdapter
|
|
|
private var isRecord = false
|
|
|
private var isAutoSwipe = false
|
|
@@ -98,6 +101,12 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
project = Gson().fromJson<Project>(intent.getStringExtra("project"), Project::class.java)
|
|
|
resourceThemeBitmap = project.sceneResource as ArrayList<String>
|
|
|
resourceActorBitmap = project.actorResource as ArrayList<ArrayList<String>>
|
|
|
+ resourceObjectPath = ArrayList<String>().apply {
|
|
|
+ project.themeAssetIndex.contains.obj.values.forEach {
|
|
|
+ val path = "${project.assetFolder.path}/${it.smallFile}"
|
|
|
+ add(path)
|
|
|
+ }
|
|
|
+ }
|
|
|
windowManager.defaultDisplay.getMetrics(monitorSize)
|
|
|
var layoutPrams = sceneEditView.layoutParams
|
|
|
layoutPrams.width = monitorSize.widthPixels
|
|
@@ -362,7 +371,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
}
|
|
|
|
|
|
private fun initActorRecyclerView() {
|
|
|
- if (viewContainer.getChildAt(0) is SelectActorView) {
|
|
|
+ if (viewContainer.getChildAt(0) is SelectActorView || viewContainer.getChildAt(0) is ObjectView) {
|
|
|
viewContainer.removeAllViews()
|
|
|
startRecord.visibility = View.VISIBLE
|
|
|
return
|
|
@@ -383,6 +392,18 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
actorRecyclerView.adapter = actorAdapter
|
|
|
viewContainer.addView(selectActorView)
|
|
|
selectActorView.layoutParams.width = monitorSize.widthPixels
|
|
|
+ selectActorView.btn_object.setOnClickListener {
|
|
|
+ viewContainer.removeAllViews()
|
|
|
+ var objectView = ObjectView(this)
|
|
|
+ objectView.setData(resourceObjectPath)
|
|
|
+ sceneEditView.findViewById<LayerView>(currentLayerIndex).setOnDragListener(objectDragListener())
|
|
|
+ viewContainer.addView(objectView)
|
|
|
+ objectView.layoutParams.width = monitorSize.widthPixels
|
|
|
+ objectView.btn_character.setOnClickListener {
|
|
|
+ viewContainer.removeAllViews()
|
|
|
+ initActorRecyclerView()
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
private fun initDialogueView(){
|
|
|
if (viewContainer.getChildAt(0) is DialogueView) {
|
|
@@ -668,6 +689,18 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
var actorRecyclerView = selectActorView.findViewById<RecyclerView>(R.id.select_actor_recycler_view)
|
|
|
actorRecyclerView.layoutManager = layoutManager
|
|
|
actorRecyclerView.adapter = actorAdapter
|
|
|
+ selectActorView.btn_object.setOnClickListener {
|
|
|
+ viewContainer.removeAllViews()
|
|
|
+ var objectView = ObjectView(this)
|
|
|
+ objectView.setData(resourceObjectPath)
|
|
|
+ sceneEditView.findViewById<LayerView>(currentLayerIndex).setOnDragListener(objectDragListener())
|
|
|
+ viewContainer.addView(objectView)
|
|
|
+ objectView.layoutParams.width = monitorSize.widthPixels
|
|
|
+ objectView.btn_character.setOnClickListener {
|
|
|
+ viewContainer.removeAllViews()
|
|
|
+ initActorRecyclerView()
|
|
|
+ }
|
|
|
+ }
|
|
|
viewContainer.addView(selectActorView)
|
|
|
}
|
|
|
}
|
|
@@ -741,6 +774,24 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
sceneEditView.setLayerVisible(currentLayerIndex)
|
|
|
}
|
|
|
|
|
|
+ private fun addObject(positionX: Int, positionY: Int, resourcePath: String) {
|
|
|
+ project.story?.let {
|
|
|
+ it.scenes?.let{
|
|
|
+ val actorData = Actor()
|
|
|
+ actorData.positionX = positionX
|
|
|
+ actorData.positionY = positionY
|
|
|
+ actorData.positionZ = it[currentSceneIndex].layers[currentLayerIndex].actors.size
|
|
|
+ actorData.sideLength = ACTOR_WIDTH
|
|
|
+ actorData.sideHeight = ACTOR_HEIGHT
|
|
|
+ actorData.resourcePath = resourcePath
|
|
|
+ actorData.parentLayerIndex = currentLayerIndex
|
|
|
+ actorData.isMovable = true
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors.add(actorData)
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sceneEditView.findViewById<LayerView>(currentLayerIndex).setOnDragListener(objectDragListener())
|
|
|
+ }
|
|
|
private fun addDialogue(positionX: Int, positionY: Int, resource: Int) {
|
|
|
project.story?.let {
|
|
|
it.scenes?.let{
|
|
@@ -1170,6 +1221,21 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private fun objectDragListener() : View.OnDragListener {
|
|
|
+ return View.OnDragListener {v, event ->
|
|
|
+ when (event.action) {
|
|
|
+ DragEvent.ACTION_DRAG_STARTED -> {
|
|
|
+ return@OnDragListener true
|
|
|
+ }
|
|
|
+ DragEvent.ACTION_DROP -> {
|
|
|
+ addObject(event.x.toInt() - 100, event.y.toInt() - 100, event.clipData.getItemAt(0).text.toString())
|
|
|
+ return@OnDragListener true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return@OnDragListener true
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
override fun onSceneTouch(){
|
|
|
unSelectActor()
|
|
|
sceneEditView.setLayerVisible(currentLayerIndex)
|