<commit_before>﻿#include "ScoreSheetScene.h"
#include "RecordScene.h"

#pragma execution_character_set("utf-8")

USING_NS_CC;

static char g_name[4][255];
static int g_scores[16][4];
static int g_currentIndex;

Scene *ScoreSheetScene::createScene() {
    auto scene = Scene::create();
    auto layer = ScoreSheetScene::create();
    scene->addChild(layer);
    return scene;
}

bool ScoreSheetScene::init() {
    if (!Layer::init()) {
        return false;
    }

    auto listener = EventListenerKeyboard::create();
    listener->onKeyReleased = CC_CALLBACK_2(Layer::onKeyReleased, this);
    _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);

    memset(_scores, 0, sizeof(_scores));

    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();

    Label *tileLabel = Label::createWithSystemFont("麻将竞赛成绩记录表", "Arial", 24);
    this->addChild(tileLabel);
    tileLabel->setPosition(Vec2(origin.x + visibleSize.width * 0.5f,
        origin.y + visibleSize.height - tileLabel->getContentSize().height * 0.5f));

    ui::Button *button = ui::Button::create();
    this->addChild(button);
    button->setScale9Enabled(true);
    button->setContentSize(Size(45, 20.0f));
    button->setTitleFontSize(12);
    button->setTitleText("重置");
    button->setPosition(Vec2(origin.x + visibleSize.width * 0.5f, origin.y + visibleSize.height - tileLabel->getContentSize().height - 10));
    button->addClickEventListener([this](Ref *) { reset(); });

    Node *node = Node::create();
    this->addChild(node);
    node->setPosition(Vec2(origin.x, (origin.y + visibleSize.height - 430) * 0.5f));

    const float gap = visibleSize.width / 6;

    for (int i = 0; i < 5; ++i) {
        LayerColor *vertLine = LayerColor::create(Color4B(255, 255, 255, 255), 2, 400);
        node->addChild(vertLine);
        vertLine->setAnchorPoint(Vec2::ANCHOR_MIDDLE_BOTTOM);
        vertLine->setPosition(Vec2(gap * (i + 1), 0.0f));
    }

    for (int i = 0; i < 21; ++i) {
        LayerColor *horzLine = LayerColor::create(Color4B(255, 255, 255, 255), visibleSize.width, 2);
        node->addChild(horzLine);
        horzLine->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT);
        horzLine->setPosition(Vec2(0.0f, 20.0f * i));
    }

    Label *label = Label::createWithSystemFont("选手姓名", "Arail", 12);
    label->setPosition(Vec2(gap * 0.5f, 390));
    node->addChild(label);

    for (int i = 0; i < 4; ++i) {
        _editBox[i] = ui::EditBox::create(Size(gap, 20.0f), ui::Scale9Sprite::create());
        _editBox[i]->setPosition(Vec2(gap * (i + 1.5f), 390));
        node->addChild(_editBox[i]);
    }

    _lockButton = ui::Button::create();
    node->addChild(_lockButton);
    _lockButton->setScale9Enabled(true);
    _lockButton->setContentSize(Size(gap, 20.0f));
    _lockButton->setTitleFontSize(12);<commit_msg>修改表格线和绘制方式<commit_after>﻿#include "ScoreSheetScene.h"
#include "RecordScene.h"

#pragma execution_character_set("utf-8")

USING_NS_CC;

static char g_name[4][255];
static int g_scores[16][4];
static int g_currentIndex;

Scene *ScoreSheetScene::createScene() {
    auto scene = Scene::create();
    auto layer = ScoreSheetScene::create();
    scene->addChild(layer);
    return scene;
}

bool ScoreSheetScene::init() {
    if (!Layer::init()) {
        return false;
    }

    auto listener = EventListenerKeyboard::create();
    listener->onKeyReleased = CC_CALLBACK_2(Layer::onKeyReleased, this);
    _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);

    memset(_scores, 0, sizeof(_scores));

    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();

    Label *tileLabel = Label::createWithSystemFont("麻将竞赛成绩记录表", "Arial", 24);
    this->addChild(tileLabel);
    tileLabel->setPosition(Vec2(origin.x + visibleSize.width * 0.5f,
        origin.y + visibleSize.height - tileLabel->getContentSize().height * 0.5f));

    ui::Button *button = ui::Button::create();
    this->addChild(button);
    button->setScale9Enabled(true);
    button->setContentSize(Size(45, 20.0f));
    button->setTitleFontSize(12);
    button->setTitleText("重置");
    button->setPosition(Vec2(origin.x + visibleSize.width * 0.5f, origin.y + visibleSize.height - tileLabel->getContentSize().height - 10));
    button->addClickEventListener([this](Ref *) { reset(); });

    DrawNode *node = DrawNode::create();
    this->addChild(node);
    node->setPosition(Vec2(origin.x, (origin.y + visibleSize.height - 430) * 0.5f));

    const float gap = visibleSize.width / 6;

    for (int i = 0; i < 5; ++i) {
        const float x = gap * (i + 1);
        node->drawLine(Vec2(x, 0.0f), Vec2(x, 400.0f), Color4F::WHITE);
    }

    for (int i = 0; i < 21; ++i) {
        const float y = 20.0f * i;
        node->drawLine(Vec2(0.0f, y), Vec2(visibleSize.width, y), Color4F::WHITE);
    }

    Label *label = Label::createWithSystemFont("选手姓名", "Arail", 12);
    label->setPosition(Vec2(gap * 0.5f, 390));
    node->addChild(label);

    for (int i = 0; i < 4; ++i) {
        _editBox[i] = ui::EditBox::create(Size(gap, 20.0f), ui::Scale9Sprite::create());
        _editBox[i]->setPosition(Vec2(gap * (i + 1.5f), 390));
        node->addChild(_editBox[i]);
    }

    _lockButton = ui::Button::create();
    node->addChild(_lockButton);
    _lockButton->setScale9Enabled(true);
    _lockButton->setContentSize(Size(gap, 20.0f));
    _lockButton->setTitleFontSize(12);
{'fraction_non_alphanumeric': 0.16914430746918058, 'fraction_numerical': 0.03607686729514141, 'mean_word_length': 3.979241877256318, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2749466', 'n_tokens_mistral': 2036, 'n_tokens_neox': 1879, 'n_words': 329}