Project V0.1.2 Record
coconutnut

描述部分

给导航栏加了一个按钮,点击显示描述

以及一个查看大图的按钮,打开一个新页面

查看大图

关于图画细节的浏览,设想过几种方案:

  • 在Unity内放大图,通过移动人物或滚动图片来查看细节

    但是移动的操作会比较复杂,和现有的控制冲突

    滚动图片的话,各张图的大小差别太大,也不好放

    还有一个是图片的版权问题,下载大图放在工程里感觉还是不太好

  • 内嵌网页

    寻找了一些实现方式,但是都比较局限,没有官方的解决方案

  • 打开新页面

    简单粗暴,虽然要跳出一下,但是专业的网站看图也好操作

于是暂且就这样了

图画信息和展板管理

以前是直接把文字信息放在展板的Object上

但是随着以后展厅的引入,会很麻烦

于是将主要信息存到了csv里,并且新增了一个单例的ArtManager,用于管理所有的文本信息和模型中展板的引用。其它Board以及GuideBar中要用到这些信息时,直接通过ArtManager获得。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ArtManager : MonoBehaviour
{
public static ArtManager instance;

// reference to each board in each hall
[SerializeField] private Board[] boardsInHall0 = null;
[SerializeField] private Board[] boardsInHall1 = null;

// number of halls
private int numOfHalls = 2;

// store art info in each hall
private Dictionary<int, ArtInfo>[] artInfoStore;

void Start()
{
if(instance != null){
GameObject.Destroy(this.gameObject);
return;
}

instance = this;

// load art info
artInfoStore = new Dictionary<int, ArtInfo>[numOfHalls];
for(int i=0; i<artInfoStore.Length; i++){
artInfoStore[i] = new Dictionary<int, ArtInfo>();
}
ArtInfoLoader.LoadArtInfo(artInfoStore);
}

// ---------- Functions for Board & GuidBar ----------
public ArtInfo GetArtInfo(int hall, int index){
return artInfoStore[hall][index];
}

// ---------- Functions for GuideBar ----------
public string getGuideMenuText(int hall, int index){
return artInfoStore[hall][index].title;
}

public int getBoardNumInHall(int hall){
return artInfoStore[hall].Count;
}

public Vector3[] getDestination(int hall, int index){
Vector3[] ret = null;

if(hall == 0){
ret = boardsInHall0[index - 1].GetDesitination(); // index begin with 1
}else if(hall == 1){
ret = boardsInHall1[index - 1].GetDesitination();
}

return ret;
}
}

这里不同展厅的展板分了不同的数组,因为二维数组没法在Unity里拖引用,只好退而求其次了

还有一个细节是,画的index都是从1开始,这个也统一在ArtManager中处理了,其它类中就不用管了

生成构建Debug

生成WebGL后,部分文字显示不全

查到一种解决方式:把颜色空间改成Linear,有错误提示,然后又把自动API取消勾选了。Graphics API变成了WebGL2.0。没用

popup和按钮中的中文都没有了,难道是字体的问题?

改了字体,重新生成,可以显示

但是,每次第一次打开总是没有?要先点过一次左或者右,后续才有显示。也许是加载顺序的问题?

调了几次顺序,还是不行

不仅是文字显示,有时刚开始滚动条也没有,后面慢慢解决吧

MARK 未解决的Bug:

新加载后,第一次点更多,无文字

点一次左/右后,有文字,但无法显示滚动条

重新点开更多,有滚动条

寻路转向Debug

有的时候寻路到了终点不会自动转向

发现设置GuideStatus为Ready后,有时Agent的remainingDistance仍是0(也许是有延迟),于是就直接到了stop状态

于是改成在Update()中修改状态,当前为Ready且remainingDistance!=0,状态改为On

当前为On且remainingDistance==0,设置转向,状态改为Static

但是这样又出现一个问题,即在原地点击寻路,状态无法变成On

于是在SetNewDestination()中先做一次判断,如果当前位置已经是目的位置,直接将状态设置成On

之前Ready和On状态是为了处理鼠标点击的一些问题,目前关于鼠标:

  • 途中 OK
  • 原地(已经到达,测试转向)
    • 导航栏 OK
    • 展板
      • 快点【被打断】
      • 慢点 OK

就很迷惑,先这样吧