// Start is called before the first frame update void Awake() { PubTool.Instance.addLogger("游戏启动"); AllUnitData.loadData(); GameData.initGameData(); ViewController.Instance.initCreateViewController(); //初始化视图 CanvasLoad.loadCanvas(); PlayerControl.Instance.initCreatePlayer(); //初始化玩家 PlayerManager.Instance.loadPlayerManager(); //加载玩家管理器 MainController.Instance.initController(); CombatController.Instance.initController(); initTools(); }
public static void loadCanvas() { GameObject obj1 = Resources.Load <GameObject>("Entity/Base"); var instance = Instantiate(obj1); instance.name = "Base"; canvas = instance.GetComponent <CanvasLoad>(); //添加相机控制 var maincam = instance.GetComponentInChildren <Camera>(); ViewController.Instance.addCameraDictionary("maincam", maincam); GameObject obj2 = Resources.Load <GameObject>("Entity/CanvasUI"); canvasui = Instantiate(obj2); canvasui.name = "CanvasUI"; canvasui.transform.position = CanvasLoad.instance.uiPos.transform.position; //添加相机控制 var uicam = canvasui.GetComponentInChildren <Camera>(); ViewController.Instance.addCameraDictionary("uicam", uicam); DontDestroyOnLoad(instance); DontDestroyOnLoad(canvasui.gameObject); }