public void Init() { _config = LabTools.GetConfig <BlueToothDeviceConfig>(); DeviceType = DeviceType.BlueTooth; switch (_config.BluetoothGetType) { case BluetoothGetType.Pick: var deviceInformation = PickDevice(); if (deviceInformation == null) { throw new InvalidDataException("Fail to retrieve device information - is the device turned on? (if so, try pairing it in Windows and try again)"); } _bluetoothDevice = BluetoothDevice.FromDeviceInformation(deviceInformation); break; case BluetoothGetType.Read: _bluetoothDevice = BluetoothDevice.FromBluetoothAddress(ulong.Parse(_config.BluetoothAddress, System.Globalization.NumberStyles.HexNumber)); break; default: throw new ArgumentOutOfRangeException(); } }
private void Awake() { PanleDatas panleDatas = LabTools.GetData <PanleDatas>("Panle", "/StreamingAssets/GameData/"); panelPathDict = panleDatas.PanelValue; GetBasePanelData(); }
/// <summary> /// 创建脚本 /// </summary> private static void UiPanelAddScripts() { formConfig = LabTools.GetConfig <UIFormConfig>(false, "/StreamingAssets/GameData/"); foreach (var item in formConfig.PanleKeys) { BuildClass(item.Key); } }
private void UpdateList() { choose.ClearOptions(); if (LabTools.GetDataName <MyGameData>() != null) { choose.AddOptions(LabTools.GetDataName <MyGameData>()); } choose.value = 0; }
/// <summary> /// 外部启动 /// </summary> private void ExternalStart() { string[] arguments = Environment.GetCommandLineArgs(); GameFlowData gameFlowData = new GameFlowData(); GameDataManager.FlowData = LabTools.GetDataByString <GameFlowData>(gameFlowData.ToJson()); GameDataManager.LabDataManager.LabDataCollectInit(() => GameDataManager.FlowData.UserId); GameSceneManager.Instance.Change2MainScene(); }
public void StartButtonClick() { UserCard userCard = LabTools.GetData <UserCard>(userChooser.captionText.text); task = new ATMTask(SetTaskType(), false, ATMTaskInfoPool.Money[UnityEngine.Random.Range(0, ATMTaskInfoPool.Money.Length)]); GameDataManager.FlowData = new GameFlowData("01", userCard, task); GameSceneManager.Instance.Change2MainScene(); }
public void Start() { LabTools.CreateDataFolder <MyGameData>(); launcher.SetActive(true); editor.SetActive(false); startButton.onClick.AddListener(StartButtonClick); settingButton.onClick.AddListener(SettingButtonClick); settingFinishButton.onClick.AddListener(SettingFinishButtonClick); deleteButton.onClick.AddListener(DeleteScripts); UpdateList(); }
public void SetUserChooserList() { userChooser.ClearOptions(); List <string> userDataList = LabTools.GetDataName <UserCard>(); if (userDataList != null) { userChooser.AddOptions(userDataList); } userChooser.value = 0; }
private void Start() { LabTools.CreateDataFolder <UserCard>(); launcher.SetActive(true); userEditor.SetActive(false); startButton.onClick.AddListener(StartButtonClick); newUserSettingButton.onClick.AddListener(NewUserSettingButtonClick); userDeletingButton.onClick.AddListener(UserDeletingButtonClick); userCreatingButton.onClick.AddListener(UserCreatingButtonClick); returnButton.onClick.AddListener(ReturnButtonClick); SetUserChooserList(); }
// Start is called before the first frame update void Start() { //必须先创建对应数据的文件夹 LabTools.CreateDataFolder <Test_FileTestData>(); #region 初始化界面信息 if (LabTools.GetDataName <Test_FileTestData>() != null) { FileDropdown.AddOptions(LabTools.GetDataName <Test_FileTestData>()); } //通过DropDown后去当前选择的数据,如果存在 var testData = LabTools.GetData <Test_FileTestData>(FileDropdown.captionText.text); //判断数据是否存在,如果存在就打印在Text上 if (testData != null) { FileInfoText.text = string.Join("\n", FileDropdown.captionText.text, testData.TestFloat, testData.TestInt, testData.TestString); } #endregion FileDropdown.onValueChanged.AddListener((a) => { testData = LabTools.GetData <Test_FileTestData>(FileDropdown.captionText.text); FileInfoText.text = string.Join("\n", FileDropdown.captionText.text, testData.TestFloat, testData.TestInt, testData.TestString); }); SaveBtn.onClick.AddListener(() => { testData = new Test_FileTestData(float.Parse(TestFloatField.text), int.Parse(TestIntField.text), TestStringField.text); LabTools.WriteData(testData, FilenameField.text); FileDropdown.ClearOptions(); FileDropdown.AddOptions(LabTools.GetDataName <Test_FileTestData>()); }); EditorBtn.onClick.AddListener(() => { testData = new Test_FileTestData(float.Parse(TestFloatField.text), int.Parse(TestIntField.text), TestStringField.text); //修改数据,所以传入true LabTools.WriteData(testData, FileDropdown.captionText.text, true); FileInfoText.text = ""; FileInfoText.text = string.Join("\n", FileDropdown.captionText.text, testData.TestFloat, testData.TestInt, testData.TestString); }); GoBtn.onClick.AddListener(() => { // GameApplication.GameDataManager.FlowData.TestData = LabTools.GetData<Test_FileTestData>(FileDropdown.captionText.text); }); }
public void StartButtonClick() { MyGameData data = LabTools.GetData <MyGameData>(choose.captionText.text); //GameFlowData gameFlow = new GameFlowData(); Debug.Log(data.angle); //GameDataManager.FlowData = gameFlow; GameDataManager.FlowData = new GameFlowData("01", data); //var Id = gameFlow.UserId; //GameDataManager.LabDataManager.LabDataCollectInit(() => Id); GameSceneManager.Instance.Change2MainScene(); //Application.Quit(); }
private void CreateUser() { if (userName.text != "" && userAccount.text != "" && userPassword.text != "") { UserCard userCard = new UserCard(userAccount.text, userPassword.text, 300000, userName.text); LabTools.WriteData(userCard, userName.text, true); SetUserChooserList(); launcher.SetActive(true); userEditor.SetActive(false); } else { inputError.enabled = true; } }
private void Awake() { var applicationConfig = LabTools.GetConfig <ApplicationConfig>(); XRSettings.enabled = applicationConfig.IsOpenVR; DontDestroyOnLoad(this); GameApplicationInit(); //自身启动 if (applicationConfig.OneSelf) { OneSelfStart(); } //外部启动 else { ExternalStart(); } }
public void SettingFinishButtonClick() { MyGameData gameData = new MyGameData(); SetData(gameData); if (scriptName.text != null || scriptName.text != "") { LabTools.WriteData(gameData, scriptName.text, true); } else { LabTools.WriteData(gameData, "default", true); } //LabTools.WriteData(gameData, "test123",true); Debug.Log("dropdown data:" + gameData.hand); Debug.Log("dropdown data:" + gameData.angle); Debug.Log("dropdown data:" + gameData.dishCount); launcher.SetActive(true); editor.SetActive(false); UpdateList(); }
void Init() { _currentObject = Instantiate(CircleObject, TestPlane.transform); StartPos = _currentObject.transform.position - new Vector3(0, 80, 0); Config = LabTools.GetConfig <GameConfig>(); if (IsConnectToServer) { new HTTPRequest(new Uri(Config.ServerPath), (request, response) => { MessageBox(IntPtr.Zero, response.DataAsText, "Connect", 0); Debug.Log(response.DataAsText); }).Send(); } #region 钮事件绑定 //StartBtn.onClick.AddListener( // (() => // { // if (ScopeIdInputField.text != "") // { // _scopeId = ScopeIdInputField.text; // InputPlane.SetActive(false); // } // else // { // MessageBox(IntPtr.Zero, "ScopeID is Null!!!", "Error", 0); // } // })); MarkBtn.onClick.AddListener( () => { TestBtnPlane.SetActive(false); StopAllCoroutines(); _currentObject.SetActive(true); StartCoroutine(MarkObjectLogic()); MarkPlane.SetActive(true); }); ReBuildBtn.onClick.AddListener(() => { StopAllCoroutines(); TestBtnPlane.SetActive(false); _currentObject.SetActive(false); MarkPlane.SetActive(false); }); TestBtn.onClick.AddListener(() => { StopAllCoroutines(); MarkPlane.SetActive(false); TestBtnPlane.SetActive(true); _currentObject.SetActive(true); StartCoroutine(TestObjectLogic()); }); //ReturnBtn.onClick.AddListener((() => //{ // StopAllCoroutines(); // CircleBtn.interactable = false; // RandomBtn.interactable = false; // InputPlane.SetActive(true); //})); QuitBtn.onClick.AddListener(() => { StopAllCoroutines(); Application.Quit(); }); #endregion }
public void UserDeletingButtonClick() { LabTools.DeleteData <UserCard>(userChooser.captionText.text); SetUserChooserList(); }
private static void Setup() { formConfig = LabTools.GetConfig <UIFormConfig>(false, "/StreamingAssets/GameData/"); Debug.Log("生成UI"); Path = new Dictionary <string, string>(); #region 生成UIRoot var UIRoot = new GameObject("UiRoot"); UIRoot.AddComponent <UIController>(); UIRoot.layer = LayerMask.NameToLayer("UI"); #endregion #region 生成Canvas var UICanvas = new GameObject("Canvas"); UICanvas.transform.SetParent(UIRoot.transform); UICanvas.AddComponent <Canvas>().renderMode = RenderMode.ScreenSpaceOverlay; var canvasScaler = UICanvas.AddComponent <CanvasScaler>(); canvasScaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize; canvasScaler.referenceResolution = new Vector2(1920, 1080); UICanvas.AddComponent <GraphicRaycaster>(); UICanvas.layer = LayerMask.NameToLayer("UI"); #endregion #region 生成EventSystem var eventSystem = new GameObject("EventSystem"); eventSystem.transform.SetParent(UIRoot.transform); eventSystem.AddComponent <EventSystem>(); eventSystem.AddComponent <StandaloneInputModule>(); eventSystem.layer = LayerMask.NameToLayer("UI"); #endregion #region 生成Panle 根据配置表来,每生成一个都需要做成预设体 foreach (var item in formConfig.PanleKeys) { GameObject PanleObject = Instantiate(Resources.Load("UiFrameWorkPrefabs/Panel")) as GameObject; PanleObject.gameObject.name = item.Key; PanleObject.transform.SetParent(UICanvas.transform, false); PanleObject.gameObject.AddComponent(LabTools.GetScriptType(item.Key)); foreach (PanleData.Data Data in item.Value) { GameObject UiObject = Instantiate(Resources.Load("UiFrameWorkPrefabs/" + Data.UIFormName)) as GameObject; UiObject.name = Data.UIObjectName; UiObject.transform.SetParent(PanleObject.transform); UiObject.transform.localPosition = new Vector3(0, 0, 0); } WriteFolder(Application.dataPath + "/Resources/" + "UiPanlePrefabs/"); var Folder = Application.dataPath + "/Resources/" + "UiPanlePrefabs/"; string FindPrefabsPath = "UiPanlePrefabs/" + item.Key; Path.Add(item.Key, FindPrefabsPath); var FilePath = Folder + item.Key + ".prefab"; PrefabUtility.SaveAsPrefabAsset(PanleObject, FilePath); DestroyImmediate(PanleObject, false); } #endregion WriteFolder(Application.dataPath + "/StreamingAssets/GameData/" + "PanleDatas/"); PanleDatas panleDatas = new PanleDatas(); panleDatas.PanelValue = Path; LabTools.WriteData(panleDatas, "Panle", true, "/StreamingAssets/GameData/"); WriteFolder(Application.dataPath + "/Resources/" + "UiRoot/"); var savedFilePath = Application.dataPath + "/Resources/" + "UiRoot/" + "UIRoot.prefab"; PrefabUtility.SaveAsPrefabAssetAndConnect(UIRoot, savedFilePath, InteractionMode.AutomatedAction); }
public override IEnumerator TaskInit() { Enemy = GameEntityManager.Instance.GetCurrentSceneRes <Test_MainScneRes>().Enemy.gameObject; EnemyConfig = LabTools.GetConfig <Test_EnemyConfig>(); yield return(null); }
public void DeleteScripts() { LabTools.DeleteData <MyGameData>(choose.captionText.text); UpdateList(); }
void Start() { LabDataTestComponent.LabDataManager.GetDataAction += (a) => _labBodyData = LabTools.GetData <LabBodyData>(a); }