2 次代碼提交 57f71248e4 ... d3e022addc

作者 SHA1 備註 提交日期
  faterhenry d3e022addc Merge branch 'bug-fix-12-10' 6 年之前
  faterhenry c577c22557 bug-fix-12-10 6 年之前
共有 1 個文件被更改,包括 42 次插入23 次删除
  1. 42 23
      src/main/java/com/bomostory/sceneeditmodule/SceneEditActivity.kt

+ 42 - 23
src/main/java/com/bomostory/sceneeditmodule/SceneEditActivity.kt

@@ -104,25 +104,9 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
                 WindowManager.LayoutParams.FLAG_FULLSCREEN)
         actionBar?.hide()
         supportActionBar?.hide()
-        project = Gson().fromJson<Project>(intent.getStringExtra("project"), Project::class.java)
-        resourceThemeBitmap = project.sceneResource as ArrayList<String>
-        resourceThemeBitmap.add(File(Config.ASSETS_FOLDER, Config.PROJECT_WHITE_FILE_NAME).path)
-        resourceActorBitmap = when(intent.getStringExtra("resource_actor")) {
-            null -> { project.actorResource as ArrayList<ArrayList<String>>}
-            else -> { Gson().fromJson<ThemeActorResource>(intent.getStringExtra("resource_actor"), ThemeActorResource::class.java).actorPath}
-        }
-        resourceObjectPath = when(intent.getStringArrayListExtra("resource_object")) {
-            null -> {
-                ArrayList<String>().apply {
-                    project.themeAssetIndex.contains.obj.values.forEach {
-                        val path = "${project.assetFolder.path}/${it.smallFile}"
-                        add(path)
-                    }
-                }
-            }
-            else -> { intent.getStringArrayListExtra("resource_object")}
-        }
         windowManager.defaultDisplay.getMetrics(monitorSize)
+        project = Gson().fromJson<Project>(intent.getStringExtra("project"), Project::class.java)
+        initResource()
         var layoutPrams = sceneEditView.layoutParams
         layoutPrams.width = monitorSize.widthPixels
         layoutPrams.height = monitorSize.widthPixels.div(2)
@@ -151,7 +135,18 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
                     }
         }
         initControlBarView()
-        initNavigationFunction()
+        project.story?.let {
+            it.scenes?.let {
+                when (it[0].record) {
+                    null -> {
+                        initNavigationFunction()
+                    }
+                    else -> {
+                        initNavigationBarView(0)
+                    }
+                }
+            }
+        }
         initRecord()
     }
 
@@ -168,6 +163,27 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
         }
     }
 
+    private fun initResource(){
+        resourceThemeBitmap = project.sceneResource as ArrayList<String>
+        if (!resourceThemeBitmap.contains(File(Config.ASSETS_FOLDER, Config.PROJECT_WHITE_FILE_NAME).path)){
+            resourceThemeBitmap.add(File(Config.ASSETS_FOLDER, Config.PROJECT_WHITE_FILE_NAME).path)
+        }
+        resourceActorBitmap = when(intent.getStringExtra("resource_actor")) {
+            null -> { project.actorResource as ArrayList<ArrayList<String>>}
+            else -> { Gson().fromJson<ThemeActorResource>(intent.getStringExtra("resource_actor"), ThemeActorResource::class.java).actorPath}
+        }
+        resourceObjectPath = when(intent.getStringArrayListExtra("resource_object")) {
+            null -> {
+                ArrayList<String>().apply {
+                    project.themeAssetIndex.contains.obj.values.forEach {
+                        val path = "${project.assetFolder.path}/${it.smallFile}"
+                        add(path)
+                    }
+                }
+            }
+            else -> { intent.getStringArrayListExtra("resource_object")}
+        }
+    }
     private fun initControlBarView() {
         controlBarView.setBtnSelected(6)
         switchToPreViewLayer()
@@ -228,6 +244,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
                     setControlSceneView()
                     editSceneView.setOnClickDoneListener(View.OnClickListener {
                         if (!isSceneRecorded) initNavigationFunction()
+                        else setControlSceneView()
                     })
                     editSceneView.setOnClickStartOverListener(View.OnClickListener {
                         project.story?.let {
@@ -1530,10 +1547,12 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
         var otherThemes =  OtherThemes()
         SuperAppModule.themeManager.themes.forEach {
             if (SuperAppModule.themeManager.canUse(it) && SuperAppModule.themeManager.isDownloaded(it)) {
-                val index = SuperAppModule.themeManager.loadThemeAssetIndex(it).blockingGet()
-                val data = it
-                var theme = Theme(index,SuperAppModule.themeManager.getAssetFolder(data))
-                otherThemes.themes.add(theme)
+                SuperAppModule.themeManager.loadThemeAssetIndex(it)
+                        .subscribe { index ->
+                            val data = it
+                            var theme = Theme(index,SuperAppModule.themeManager.getAssetFolder(data))
+                            otherThemes.themes.add(theme)
+                        }
             }
         }
         val json = Gson().toJson(project)