-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This was a triumph. im making a note here, huge success
- Loading branch information
1 parent
e3bfdff
commit 6e52128
Showing
16 changed files
with
373 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Submodule translations
updated
7 files
+60 −2 | README.md | |
+334 −0 | base.json | |
+345 −0 | langs/de-DE.json | |
+345 −0 | langs/in-ID.json | |
+352 −0 | langs/ko-KR.json | |
+334 −0 | langs/ru-RU.json | |
+345 −0 | langs/uk-UA.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#include "LanguageSelectNode.hpp" | ||
#include "../Utils/UnspeedhackedAction.hpp" | ||
|
||
bool LanguageSelectNode::init() | ||
{ | ||
if (!CCNode::init()) | ||
return false; | ||
|
||
this->setContentSize(CCDirector::get()->getWinSize()); | ||
this->setAnchorPoint(CCPointZero); | ||
this->setKeypadEnabled(true); | ||
|
||
auto colBG = CCLayerColor::create(ccc4(0, 0, 0, 0)); | ||
colBG->ignoreAnchorPointForPosition(false); | ||
colBG->setAnchorPoint(ccp(1, 1)); | ||
colBG->runAction(CCFadeTo::create(0.5f, 100)); | ||
|
||
node = CCMenu::create(); | ||
node->ignoreAnchorPointForPosition(false); | ||
node->setContentSize(CCPointZero); | ||
node->setScale(0); | ||
node->runAction(UnspeedhackedAction::create(CCEaseElasticOut::create(CCScaleTo::create(0.5f, 1), 0.6f))); | ||
|
||
auto leftBtn = CCMenuItemSpriteExtra::create(CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png"), this, menu_selector(LanguageSelectNode::onLeft)); | ||
leftBtn->setZOrder(420); | ||
node->addChildAtPosition(leftBtn, Anchor::BottomLeft, ccp(-190, 0)); | ||
|
||
auto rightBtn = CCMenuItemSpriteExtra::create(CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png"), this, menu_selector(LanguageSelectNode::onRight)); | ||
rightBtn->getNormalImage()->setScaleX(-1); | ||
rightBtn->setZOrder(420); | ||
node->addChildAtPosition(rightBtn, Anchor::BottomLeft, ccp(190, 0)); | ||
|
||
node->setTouchPriority(-999999); | ||
|
||
goToPage(0); | ||
|
||
this->addChild(colBG); | ||
this->addChildAtPosition(node, Anchor::Center); | ||
return true; | ||
} | ||
|
||
void LanguageSelectNode::goToPage(int page) | ||
{ | ||
this->page = page; | ||
|
||
if (layer) | ||
{ | ||
layer->removeFromParent(); | ||
layer = nullptr; | ||
} | ||
|
||
auto langs = Client::get()->getLanguages(); | ||
|
||
if (page == 0) | ||
layer = TranslationCreditsLayer::create(matjson::parse("{ \"display_name_english\": \"Default\", \"display_name_native\": \"English\", \"contributors\": [] }").unwrapOr("{}"), "none"); | ||
else | ||
layer = TranslationCreditsLayer::create(file::readJson(langs[page - 1]).unwrap(), langs[page - 1]); | ||
|
||
layer->setPosition(CCDirector::get()->getWinSize() * -0.5f); | ||
layer->stopAllActions(); | ||
layer->setOpacity(0); | ||
layer->setKeypadEnabled(false); | ||
layer->setKeyboardEnabled(false); | ||
|
||
layer->baseLayer->stopActionByTag(69); | ||
layer->baseLayer->setScale(1); | ||
|
||
layer->ok->setTarget(this, menu_selector(LanguageSelectNode::onSubmit)); | ||
|
||
node->addChild(layer, 420); | ||
} | ||
|
||
void LanguageSelectNode::onLeft(CCObject* sender) | ||
{ | ||
page--; | ||
|
||
if (page < 0) | ||
page = Client::get()->getLanguages().size(); | ||
|
||
goToPage(page); | ||
} | ||
|
||
void LanguageSelectNode::onRight(CCObject* sender) | ||
{ | ||
page++; | ||
|
||
if (page > Client::get()->getLanguages().size()) | ||
page = 0; | ||
|
||
goToPage(page); | ||
} | ||
|
||
void LanguageSelectNode::onSubmit(CCObject* sender) | ||
{ | ||
keyBackClicked(); | ||
} | ||
|
||
void LanguageSelectNode::keyBackClicked() | ||
{ | ||
this->removeFromParent(); | ||
} | ||
|
||
LanguageSelectNode* LanguageSelectNode::addToScene() | ||
{ | ||
auto pRet = LanguageSelectNode::create(); | ||
|
||
CCScene::get()->addChild(pRet, 99999); | ||
|
||
return pRet; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#include <Geode/Geode.hpp> | ||
#include "TranslationCreditsLayer.hpp" | ||
|
||
using namespace geode::prelude; | ||
|
||
class LanguageSelectNode : public CCLayer | ||
{ | ||
public: | ||
CCMenu* node; | ||
TranslationCreditsLayer* layer; | ||
int page = 0; | ||
|
||
bool init(); | ||
|
||
void goToPage(int page); | ||
|
||
virtual void keyBackClicked(); | ||
void onSubmit(CCObject* sender); | ||
|
||
void onLeft(CCObject* sender); | ||
void onRight(CCObject* sender); | ||
|
||
CREATE_FUNC(LanguageSelectNode); | ||
static LanguageSelectNode* addToScene(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.