Exemplo n.º 1
0
    // -------------------------------------------------------------------
    // OK�{�^�����N���b�N��������OK�{�^����OnClick����R�[������A
    // ���r�[�֑J�ڂ���B
    // -------------------------------------------------------------------
    public void OnClickOK()
    {
        // ���b�Z�[�W�E�B���h�E���\���̏ꍇ
        if (!IsWindow)
        {
            // ID�t�B�[���h�ɉ�����͂���Ă��Ȃ��ꍇ
            if ("" == nameField.text)
            {
                MessageWriteToWindow("�����́B\n���O�C��ID����͂��ĉ������B");
                return;
            }
            // ���͂��ꂽID���uNameLess�v�̏ꍇ
            else if ("NameLess" == nameField.text)
            {
                gameManager.userName = "******";
            }
            // ID������ɓ��͂��ꂽ�ꍇ
            else
            {
                // LinkToXML�N���X��쐬
                var t = new AppSettings();

                string xmlFile = "sample.xml";
                if (false == System.IO.File.Exists(xmlFile))
                {
                    // �t�@�C�����Ȃ���΍쐬����
                    t.CreateXmlFile();
                }

                // ID�������Ĉ�v�����烍�[�h����
                // �����͂܂������ĂȂ�
                // ��v����ID���Ȃ���΃G���[������b�Z�[�W�E�B���h�E�ŕ\��
                // ���͂��ꂽID���疼�O��t��������GM�̃t�B�[���h�Ɋi�[
                gameManager.userName = nameField.text.ToString();
            }

            // ���񂩂�̓��͂���������邽�߁A���͂��ꂽ�������t�@�C���ɏ����o��
            var streamWriter = new StreamWriterSingleLine();
            string fileName = "iid.txt";
            string filetxt = nameField.text;
            bool result = streamWriter.WriteToStream(fileName, filetxt);

            // �V�[���J�ڃ��\�b�h�R�[��
            NextScene();
        }
        // ���b�Z�[�W�E�B���h�E���\������Ă���ꍇ
        else
        {
            // ���b�Z�[�W�E�B���h�E���A�N�e�B�u��
            warningParentGO.SetActive(false);

            // ���b�Z�[�W�E�B���h�E�\���L������t���O��ύX
            IsWindow = false;
        }
    }