예제 #1
0
        private void SaveChangesButton_Click(object sender, RoutedEventArgs e)
        {
            // Do data validation first
            // Check that Name is valid
            if (!NameIsValid(newOrder.Name))
            {
                MessageBox.Show("Name can not be empty or contain numbers.", "Alert", MessageBoxButton.OK, MessageBoxImage.Information);
                UserNameData.Clear();
                return;
            }

            // Check that Date is valid
            if (!DateIsValid(newOrder.Date))
            {
                MessageBox.Show("The date is incorrect.", "Alert", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            // Check that the Order number is valid
            if (!OrderIsValid(newOrder.OrderNumber))
            {
                MessageBox.Show("The order number is incorrect.", "Alert", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            // Create Excel object
            office.Excel.Application xlApp;
            office.Excel.Workbook    xlWorkBook;
            office.Excel.Worksheet   xlWorkSheet;

            xlApp      = new office.Excel.Application();
            xlWorkBook = xlApp.Workbooks.Open(newOrder.ExcelPath);

            xlWorkSheet = (office.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);

            // Update data entered from user into Excel
            xlWorkSheet.Cells[1, 2] = newOrder.Name;
            xlWorkSheet.Cells[2, 2] = newOrder.Date;
            xlWorkSheet.Cells[3, 2] = newOrder.OrderNumber;
            xlWorkBook.Save();

            // Release Excel resources
            xlApp.Quit();
            Marshal.ReleaseComObject(xlWorkSheet);
            Marshal.ReleaseComObject(xlWorkBook);
            Marshal.ReleaseComObject(xlApp);

            // Create Word object


            // Update data entered from user for Word


            // Release Word resources

            // Set ability to print
            PrintButton.IsEnabled = true;
        }
예제 #2
0
    public void Init()
    {
        if (JSON.JsonUtil.FileCheck("UserData")) //유저 메인 캐릭터 JSON
        {
            CharData [] JsonData = JSON.JsonUtil.LoadArrJson <CharData>("UserData");
            for (int i = 0; i < JsonData.Length; i++)
            {
                CompanionSetting(JsonData[i]);
            }
        }
        //유저 동료 셋팅

        if (JSON.JsonUtil.FileCheck("UserNameData"))
        {
            UserNameData JsonData = JSON.JsonUtil.LoadJson <UserNameData>("UserNameData");
            UserName = JsonData.m_strUserName;
        }
        //유저 이름 셋팅

        if (JSON.JsonUtil.FileCheck(""))
        {
            CharData[] JsonData = JSON.JsonUtil.LoadArrJson <CharData>("UserData");
        }
    }
예제 #3
0
    public void OnClick()
    {
        string strValue = m_InputFiled.transform.GetChild(1).GetComponent <UIInput>().value;

        if (strValue.Length < 8 && strValue.Length > 1)
        {
            //8자리 미만이다.
            if (!JSON.JsonUtil.FileCheck("UserNameData")) //현재 파일이 있는가?
            {
                UserNameData Node = new UserNameData();
                Node.m_strUserName = strValue;
                string jsonData = JSON.JsonUtil.ToJson(Node);
                Debug.Log(jsonData);
                JSON.JsonUtil.CreateJson("UserNameData", jsonData);
            }

            if (!JSON.JsonUtil.FileCheck("UserData")) //현재 파일이 있는가?
            {
                //없으면 데이터 생성
                //메인 캐릭터 라벨
                CharData[] Node = new CharData[1];
                Node[0]          = new CharData();
                Node[0].m_Level  = 1;
                Node[0].m_iIndex = 0;
                Node[0].m_CurEXP = 0;
                Node[0].m_eClass = CLASS.CLASS_THIEF;

                string jsonData = JSON.JsonUtil.ToJson <CharData>(Node);
                Debug.Log(jsonData);
                JSON.JsonUtil.CreateJson("UserData", jsonData);
                //플레이어 캐릭터 JSON
            }

            if (!JSON.JsonUtil.FileCheck("UserPartyData"))
            {
                CharPartyList Node = new CharPartyList();
                Node.m_PartyListIndex    = new int[4];
                Node.m_PartyListIndex[0] = 0;
                Node.m_PartyListIndex[1] = -1;
                Node.m_PartyListIndex[2] = -1;
                Node.m_PartyListIndex[3] = -1;

                string jsonData = JSON.JsonUtil.ToJson(Node);
                Debug.Log(jsonData);
                JSON.JsonUtil.CreateJson("UserPartyData", jsonData);
                //플레이어 캐릭터 JSON
            }

            if (!JSON.JsonUtil.FileCheck("UserMapData"))    //유저 맵 데이터
            {
                MapSaveData[] Node = new MapSaveData[3];

                for (int i = 0; i < 3; i++)
                {
                    Node[i] = new MapSaveData();
                    Node[i].m_bStageClear = false;
                }
                //현재는 맵이 세가지

                string jsonData = JSON.JsonUtil.ToJson <MapSaveData>(Node);
                Debug.Log(jsonData);
                JSON.JsonUtil.CreateJson("UserMapData", jsonData);
            }

            UserInfo.instance.Init();
            UserInfo.instance.PartySetting();
            GameManager.instance.Init();

            //플레이어 캐릭터 정보가 존재한다면 로딩
            LoadScene.SceneLoad("LobbyScene");
            //게임 씬 로딩
        }
    }