예제 #1
0
		private void DrawInit()
		{
			if (mHasConfigFile)
			{
				GUILayout.BeginHorizontal();
				GUILayout.Label("当前版本号", GUILayout.Width(100));
				GUILayout.Label(mPackageVersion.Version, GUILayout.Width(100));
				GUILayout.EndHorizontal();
			}

			GUILayout.BeginHorizontal();
			GUILayout.Label("发布版本号", GUILayout.Width(100));
			mVersionText = GUILayout.TextField(mVersionText, GUILayout.Width(100));
			GUILayout.EndHorizontal();

			GUILayout.BeginHorizontal();
			GUILayout.Label("类型", GUILayout.Width(100));

			mPackageVersion.Type = (PackageType) EditorGUILayout.EnumPopup(mPackageVersion.Type);

			GUILayout.EndHorizontal();

			GUILayout.BeginHorizontal();
			GUILayout.Label("权限", GUILayout.Width(100));

			mPackageVersion.AccessRight = (PackageAccessRight) EditorGUILayout.EnumPopup(mPackageVersion.AccessRight);
			GUILayout.EndHorizontal();

			GUILayout.Label("发布说明:", GUILayout.Width(150));
			mReleaseNote = GUILayout.TextArea(mReleaseNote, GUILayout.Width(250), GUILayout.Height(300));

			if (User.Token.Value.IsNullOrEmpty())
			{
				User.Username.Value = EditorGUIUtils.GUILabelAndTextField("username:"******"password:"******"登录"))
				{
					GetTokenAction.DoGetToken(User.Username.Value, User.Password.Value, token =>
					{
						User.Token.Value = token;
						User.Save();
					});
				}

				if (!inRegisterView && GUILayout.Button("注册"))
				{
					inRegisterView = true;
				}

				if (inRegisterView)
				{
					if (GUILayout.Button("注册"))
					{

					}

					if (GUILayout.Button("返回注册"))
					{
						inRegisterView = false;
					}
				}
			}
			else
			{
				if (GUILayout.Button("注销"))
				{
					User.Token.Value = string.Empty;
					User.Save();
				}
			}

			if (User.Token.Value.IsNotNullAndEmpty() && GUILayout.Button("发布"))
			{
				User.Save();

				if (mReleaseNote.Length < 2)
				{
					ShowErrorMsg("请输入版本修改说明");
					return;
				}

				if (!IsVersionValide(mVersionText))
				{
					ShowErrorMsg("请输入正确的版本号");
					return;
				}

				mPackageVersion.Version = mVersionText;
				mPackageVersion.Readme = new ReleaseItem(mVersionText, mReleaseNote, SystemInfo.deviceName,
					DateTime.Now.ToString("yyyy-MM-dd"));


				mPackageVersion.Save();

				AssetDatabase.Refresh();

				GotoPacking();
			}
		}