#pragma once
#include "BaseForm.h"
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;


namespace ObjDataEdit
{
	/// <summary> 
	/// Summary for ScriptForm
	///
	/// WARNING: If you change the name of this class, you will need to change the 
	///          'Resource File Name' property for the managed resource compiler tool 
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
#ifndef _Just_Show_DotNet_Form_
    public __gc class ScriptForm : public System::Windows::Forms::Form
#else 
    public __gc class ScriptForm : public BaseForm
#endif		
	{
	public: 
        ScriptForm( char* FormName , char* DBName , char* OutputFile  , bool IsReadOnly , SearchFormTypeENUM FormType ) :  BaseForm( FormName , DBName , OutputFile  , IsReadOnly , FormType )
		{
			InitializeComponent();
            this->panel4_Base->Controls->Add(this->panel1);
			this->Text = (String*)FormName;
		}
        
	protected: 
		void Dispose(Boolean disposing)
		{
			if (disposing && components)
			{
				components->Dispose();
			}
			__super::Dispose(disposing);
		}
    private: System::Windows::Forms::Panel *  panel1;
    private: System::Windows::Forms::Panel *  panel2;
    private: System::Windows::Forms::Label *  label1;
    private: System::Windows::Forms::ComboBox *  comboBox1;
    private: System::Windows::Forms::TextBox *  textBox1;
    private: System::Windows::Forms::Label *  label2;
    private: System::Windows::Forms::Label *  label3;

    private: System::Windows::Forms::TextBox *  ED_FuncArg;
    private: System::Windows::Forms::Button *  button1;








    private: System::Windows::Forms::StatusBar *  statusBar1;
    private: System::Windows::Forms::Splitter *  splitter1;
    private: System::Windows::Forms::Panel *  panel4;
    private: System::Windows::Forms::RichTextBox *  richTextBox2;
	private: System::Windows::Forms::ComboBox*  CB_ShowTitleSet;
	private: System::Windows::Forms::Button*  button2;




    private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container* components;

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->panel1 = (new System::Windows::Forms::Panel());
			this->panel4 = (new System::Windows::Forms::Panel());
			this->richTextBox2 = (new System::Windows::Forms::RichTextBox());
			this->splitter1 = (new System::Windows::Forms::Splitter());
			this->statusBar1 = (new System::Windows::Forms::StatusBar());
			this->panel2 = (new System::Windows::Forms::Panel());
			this->CB_ShowTitleSet = (new System::Windows::Forms::ComboBox());
			this->button1 = (new System::Windows::Forms::Button());
			this->label3 = (new System::Windows::Forms::Label());
			this->ED_FuncArg = (new System::Windows::Forms::TextBox());
			this->label2 = (new System::Windows::Forms::Label());
			this->textBox1 = (new System::Windows::Forms::TextBox());
			this->comboBox1 = (new System::Windows::Forms::ComboBox());
			this->label1 = (new System::Windows::Forms::Label());
			this->button2 = (new System::Windows::Forms::Button());
			this->panel1->SuspendLayout();
			this->panel4->SuspendLayout();
			this->panel2->SuspendLayout();
			this->SuspendLayout();
			// 
			// panel1
			// 
			this->panel1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
			this->panel1->Controls->Add(this->panel4);
			this->panel1->Controls->Add(this->splitter1);
			this->panel1->Controls->Add(this->statusBar1);
			this->panel1->Controls->Add(this->panel2);
			this->panel1->Dock = System::Windows::Forms::DockStyle::Fill;
			this->panel1->Location = System::Drawing::Point(0, 0);
			this->panel1->Name = S"panel1";
			this->panel1->Size = System::Drawing::Size(1005, 702);
			this->panel1->TabIndex = 0;
			// 
			// panel4
			// 
			this->panel4->Controls->Add(this->richTextBox2);
			this->panel4->Dock = System::Windows::Forms::DockStyle::Fill;
			this->panel4->Location = System::Drawing::Point(0, 40);
			this->panel4->Name = S"panel4";
			this->panel4->Size = System::Drawing::Size(1001, 633);
			this->panel4->TabIndex = 5;
			// 
			// richTextBox2
			// 
			this->richTextBox2->AcceptsTab = true;
			this->richTextBox2->Dock = System::Windows::Forms::DockStyle::Fill;
			this->richTextBox2->Location = System::Drawing::Point(0, 0);
			this->richTextBox2->MaxLength = 50000;
			this->richTextBox2->Name = S"richTextBox2";
			this->richTextBox2->Size = System::Drawing::Size(1001, 633);
			this->richTextBox2->TabIndex = 2;
			this->richTextBox2->Tag = S"Text";
			this->richTextBox2->Text = S"";
			this->richTextBox2->Leave += new System::EventHandler(this, &ScriptForm::richTextBox2_Leave);
			this->richTextBox2->TextChanged += new System::EventHandler(this, &ScriptForm::richTextBox2_TextChanged);
			// 
			// splitter1
			// 
			this->splitter1->Dock = System::Windows::Forms::DockStyle::Bottom;
			this->splitter1->Location = System::Drawing::Point(0, 673);
			this->splitter1->Name = S"splitter1";
			this->splitter1->Size = System::Drawing::Size(1001, 3);
			this->splitter1->TabIndex = 4;
			this->splitter1->TabStop = false;
			// 
			// statusBar1
			// 
			this->statusBar1->Location = System::Drawing::Point(0, 676);
			this->statusBar1->Name = S"statusBar1";
			this->statusBar1->Size = System::Drawing::Size(1001, 22);
			this->statusBar1->TabIndex = 3;
			this->statusBar1->Text = S"statusBar1";
			// 
			// panel2
			// 
			this->panel2->Controls->Add(this->button2);
			this->panel2->Controls->Add(this->CB_ShowTitleSet);
			this->panel2->Controls->Add(this->button1);
			this->panel2->Controls->Add(this->label3);
			this->panel2->Controls->Add(this->ED_FuncArg);
			this->panel2->Controls->Add(this->label2);
			this->panel2->Controls->Add(this->textBox1);
			this->panel2->Controls->Add(this->comboBox1);
			this->panel2->Controls->Add(this->label1);
			this->panel2->Dock = System::Windows::Forms::DockStyle::Top;
			this->panel2->Location = System::Drawing::Point(0, 0);
			this->panel2->Name = S"panel2";
			this->panel2->Size = System::Drawing::Size(1001, 40);
			this->panel2->TabIndex = 0;
			// 
			// CB_ShowTitleSet
			// 
			this->CB_ShowTitleSet->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			System::Object* __mcTemp__1[] = new System::Object*[3];
			__mcTemp__1[0] = S"名稱";
			__mcTemp__1[1] = S"函式名稱";
			__mcTemp__1[2] = S"名稱&函式名稱";
			this->CB_ShowTitleSet->Items->AddRange(__mcTemp__1);
			this->CB_ShowTitleSet->Location = System::Drawing::Point(794, 8);
			this->CB_ShowTitleSet->Name = S"CB_ShowTitleSet";
			this->CB_ShowTitleSet->Size = System::Drawing::Size(96, 20);
			this->CB_ShowTitleSet->TabIndex = 7;
			this->CB_ShowTitleSet->Tag = S"";
			this->CB_ShowTitleSet->Visible = false;
			this->CB_ShowTitleSet->SelectedIndexChanged += new System::EventHandler(this, &ScriptForm::CB_ShowTitleSet_SelectedIndexChanged);
			// 
			// button1
			// 
			this->button1->Location = System::Drawing::Point(703, 6);
			this->button1->Name = S"button1";
			this->button1->Size = System::Drawing::Size(75, 23);
			this->button1->TabIndex = 6;
			this->button1->Text = S"文法檢查";
			this->button1->Click += new System::EventHandler(this, &ScriptForm::Parse_Click);
			// 
			// label3
			// 
			this->label3->Location = System::Drawing::Point(392, 8);
			this->label3->Name = S"label3";
			this->label3->Size = System::Drawing::Size(32, 16);
			this->label3->TabIndex = 5;
			this->label3->Text = S"參數";
			// 
			// ED_FuncArg
			// 
			this->ED_FuncArg->Location = System::Drawing::Point(424, 8);
			this->ED_FuncArg->Name = S"ED_FuncArg";
			this->ED_FuncArg->Size = System::Drawing::Size(273, 22);
			this->ED_FuncArg->TabIndex = 4;
			this->ED_FuncArg->Tag = S"FuncArg";
			this->ED_FuncArg->Text = S"textBox2";
			this->ED_FuncArg->TextChanged += new System::EventHandler(this, &ScriptForm::GetStr_TextChanged);
			// 
			// label2
			// 
			this->label2->Location = System::Drawing::Point(152, 8);
			this->label2->Name = S"label2";
			this->label2->Size = System::Drawing::Size(56, 16);
			this->label2->TabIndex = 3;
			this->label2->Text = S"函式名稱";
			// 
			// textBox1
			// 
			this->textBox1->Location = System::Drawing::Point(208, 8);
			this->textBox1->Name = S"textBox1";
			this->textBox1->Size = System::Drawing::Size(176, 22);
			this->textBox1->TabIndex = 2;
			this->textBox1->Tag = S"FuncName";
			this->textBox1->Text = S"textBox1";
			this->textBox1->TextChanged += new System::EventHandler(this, &ScriptForm::textBox1_TextChanged);
			this->textBox1->Leave += new System::EventHandler(this, &ScriptForm::textBox1_Leave);
			// 
			// comboBox1
			// 
			this->comboBox1->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			System::Object* __mcTemp__2[] = new System::Object*[4];
			__mcTemp__2[0] = S"主劇情";
			__mcTemp__2[1] = S"副程式";
			__mcTemp__2[2] = S"系統";
			__mcTemp__2[3] = S"系統副程式";
			this->comboBox1->Items->AddRange(__mcTemp__2);
			this->comboBox1->Location = System::Drawing::Point(48, 8);
			this->comboBox1->Name = S"comboBox1";
			this->comboBox1->Size = System::Drawing::Size(96, 20);
			this->comboBox1->TabIndex = 1;
			this->comboBox1->Tag = S"Type";
			this->comboBox1->SelectedIndexChanged += new System::EventHandler(this, &ScriptForm::GetIndex_SelectedIndexChanged);
			// 
			// label1
			// 
			this->label1->Location = System::Drawing::Point(8, 8);
			this->label1->Name = S"label1";
			this->label1->Size = System::Drawing::Size(48, 16);
			this->label1->TabIndex = 0;
			this->label1->Text = S"類型";
			// 
			// button2
			// 
			this->button2->Location = System::Drawing::Point(923, 7);
			this->button2->Name = S"button2";
			this->button2->Size = System::Drawing::Size(75, 23);
			this->button2->TabIndex = 8;
			this->button2->Text = S"單檔輸出";
			this->button2->Click += new System::EventHandler(this, &ScriptForm::OutputOneFile_Click);
			// 
			// ScriptForm
			// 
			this->AutoScaleBaseSize = System::Drawing::Size(5, 15);
			this->ClientSize = System::Drawing::Size(1005, 702);
			this->Controls->Add(this->panel1);
			this->Name = S"ScriptForm";
			this->Text = S"ScriptForm";
			this->panel1->ResumeLayout(false);
			this->panel4->ResumeLayout(false);
			this->panel2->ResumeLayout(false);
			this->panel2->PerformLayout();
			this->ResumeLayout(false);

		}	


#ifndef _Just_Show_DotNet_Form_
    private:
        System::Void GetStr_TextChanged(System::Object *  sender, System::EventArgs *  e);
        System::Void GetValue_ValueChanged(System::Object *  sender, System::EventArgs *  e);
        System::Void ChangeFlag(System::Object *  sender, System::EventArgs *  e);
        System::Void GetIndex_SelectedIndexChanged(System::Object *  sender, System::EventArgs *  e);
        System::Void GetIntValue_TextChanged(System::Object *  sender, System::EventArgs *  e);
        System::Void BaseForm_Closing(System::Object *  sender, System::ComponentModel::CancelEventArgs *  e);
        System::Void SearchObj_DClick(System::Object *  sender, System::EventArgs *  e);

#endif
    protected:
        //######################################################################################################
        //主要需要繼承的涵式
        virtual ReaderClass< DB_GameObjDbStruct >* ObjReader( );        
        virtual void    OnActive();
        virtual void    OnSelectObj( bool LockOk );
        virtual void    OnOutputObjSetting( DB_GameObjDbStruct* TempObj );
        virtual void    OnTimeProc();
        virtual int     ObjSize();
        //######################################################################################################
//		virtual  void    UpDateList( );


    private: bool    IsEditChangeText;
    private: bool    IsEditChangeText_FuncName;
    private: System::Void richTextBox2_TextChanged(System::Object *  sender, System::EventArgs *  e);
    private: System::Void richTextBox2_Leave(System::Object *  sender, System::EventArgs *  e);
    private: System::Void textBox1_TextChanged(System::Object *  sender, System::EventArgs *  e);
    private: System::Void textBox1_Leave(System::Object *  sender, System::EventArgs *  e);
    public:
		void	OutputFileLanguage( int Language );
		void	OutputFileEx( int Language , char* WhereCmd );
        //單一輸出
        void   OnOuputObj( char* Path , DB_GameObjDbStruct*  TempObjDB );
        void   LuaParse( DB_GameObjDbStruct*  TempObjDB );
		bool   LuaFunctionNameDuplicationCheck();

		

		System::Void Parse_Click(System::Object *  sender, System::EventArgs *  e);
		System::Void button2_Click(System::Object *  sender, System::EventArgs *  e);
		System::Void CB_ShowTitleSet_SelectedIndexChanged(System::Object*  sender, System::EventArgs*  e) 
		{
			UpDateList( );
		}
		System::Void OutputOneFile_Click(System::Object*  sender, System::EventArgs*  e);
};
}