public void OnEnable() { // Each editor window contains a root VisualElement object VisualElement root = rootVisualElement; // A stylesheet can be added to a VisualElement. // The style will be applied to the VisualElement and all of its children. var styleSheet = Resources.Load <StyleSheet>("Styles/LicenseSpringStyles"); root.styleSheets.Add(styleSheet); // Import UXML var visualTree = Resources.Load <VisualTreeAsset>("Layouts/LicenseSpringRegistration"); VisualElement cloneTree = visualTree.CloneTree(); root.Add(cloneTree); _btnRegister = cloneTree.Query <Button>("btnSubmit"); _btnRequestDemo = cloneTree.Query <Button>("btnRequestTrial"); _txtEmail = cloneTree.Query <TextField>("email"); _txtSerial = cloneTree.Query <TextField>("cdkey"); _lblStatusHeader = cloneTree.Query <Label>("lblStatusHeader"); _lblStatusLicense = cloneTree.Query <Label>("lblStatus"); _btnRegister.clickable.clicked += OnRegisterClick; _btnRequestDemo.clickable.clicked += OnRequestDemoClick; var trialElement = cloneTree.Query <Label>("trial"); trialElement.NotVisible(); //checking status var isInitialized = LicenseSpringUnityAssets.GetInitializeStatus(); if (isInitialized) { trialElement.Visible(); _lblStatusHeader.text = $"License Type : {LicenseSpringUnityAssets.GetCurrentLicense().Type()}"; if (LicenseSpringUnityAssets.GetCurrentLicense().IsTrial()) { _lblStatusLicense.text = $"Trial Days : {LicenseSpringUnityAssets.GetCurrentLicense().DaysRemaining()}"; } else { _lblStatusLicense.text = $"{LicenseSpringUnityAssets.GetCurrentLicense().Key()}"; } } else { trialElement.NotVisible(); } }
private void OnToggleDevModeClick() { if (_btnTestMode.text == StopNonDevMode) { _btnTestMode.text = TestNonDevMode; } else { _btnTestMode.text = StopNonDevMode; } LicenseSpringUnityAssets.DeveloperToggleTestMode(); }
private void OnRegisterClick() { LicenseSpringUnityAssets.Register(_txtSerial.text); this.Close(); }
private void OnRequestDemoClick() { LicenseSpringUnityAssets.RequestDemo(_txtEmail.text); this.Close(); }
public void OnEnable() { // Each editor window contains a root VisualElement object VisualElement root = rootVisualElement; // Import UXML //var visualTree = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>("Assets/Plugins/LicenseSpring/Publisher/Editor/AuthorLicensingWindow.uxml"); var visualTree = Resources.Load <VisualTreeAsset>("Layouts/AuthorLicensingWindow"); VisualElement uiTree = visualTree.CloneTree(); root.Add(uiTree); // A stylesheet can be added to a VisualElement. // The style will be applied to the VisualElement and all of its children. //var styleSheet = AssetDatabase.LoadAssetAtPath<StyleSheet>("Assets/Plugins/LicenseSpring/Styles/LicenseSpringStyles.uss"); var styleSheet = Resources.Load <StyleSheet>("Styles/LicenseSpringStyles"); root.styleSheets.Add(styleSheet); //querying input part _txtInputKey = root.Q <TextField>("inputApiKey"); _txtInputSharedKey = root.Q <TextField>("inputApiSharedKey"); _txtProductCode = root.Q <TextField>("inputApiProductCode"); _txtProductName = root.Q <TextField>("inputApiProductName"); _txtProductVersion = root.Q <TextField>("inputApiAppVersion"); //header image _headerImage = root.Q <VisualElement>(className: "HeaderImage"); _headerImage.style.unitySliceLeft = new StyleInt(StyleKeyword.Auto); _headerImage.style.unitySliceRight = new StyleInt(StyleKeyword.Auto); _headerImage.style.unitySliceTop = new StyleInt(StyleKeyword.Auto); _headerImage.style.unitySliceBottom = new StyleInt(StyleKeyword.Auto); //querying buttons _btnPublishKey = root.Q <Button>("btnGenerateFile"); _btnPublishKey.clickable.clicked += OnBtnCreateFileClick; _btnDevKey = root.Q <Button>("btnGenerateDevFile"); _btnDevKey.clickable.clicked += OnbtnCreateDevClick; _btnTestMode = root.Query <Button>("btnToggleDevMode"); _btnTestMode.text = TestNonDevMode; _btnTestMode.clickable.clicked += OnToggleDevModeClick; //reseting license, for dev only _btnResetLicense = root.Query <Button>("btnResetLicense"); _btnResetLicense.clickable.clicked += OnResetLicenseClick; //checking initialize status.. var isInitialized = LicenseSpringUnityAssets.GetInitializeStatus(); //checking current installed license var currentLicense = LicenseSpringUnityAssets.GetCurrentLicense(); //detect the real mode of editor var isDeveloper = LicenseSpringUnityAssets.GetDeveloperStatus(); if (isInitialized) { if (!isDeveloper) { _btnDevKey.SetEnabled(false); _btnPublishKey.SetEnabled(false); _btnTestMode.SetEnabled(false); _btnResetLicense.SetEnabled(false); } else { if (currentLicense != null) { _btnDevKey.SetEnabled(true); _btnPublishKey.SetEnabled(true); _btnTestMode.SetEnabled(true); _btnResetLicense.SetEnabled(true); } else { _btnDevKey.SetEnabled(false); _btnPublishKey.SetEnabled(false); _btnTestMode.SetEnabled(false); _btnResetLicense.SetEnabled(false); } } } else { _btnDevKey.SetEnabled(true); _btnPublishKey.SetEnabled(true); _btnTestMode.SetEnabled(false); _btnResetLicense.SetEnabled(false); } }
private void OnResetLicenseClick() { LicenseSpringUnityAssets.ResetLicense(); }
private void OnResetLicenseClick() { //got an error here, hack LicenseSpringUnityAssets.ResetLicense(); }