Exemplo n.º 1
0
	UIEnterNumber::UIEnterNumber(std::string q, std::function<void(int32_t)> nh, int32_t mi, int32_t ma, int32_t de)
		: UINotice(q) {

		numhandler = nh;
		min = mi;
		max = ma;

		int16_t belowtext = UINotice::box2offset();

		nl::node src = nl::nx::ui["Basic.img"];

		buttons[OK] = std::make_unique<MapleButton>(src["BtOK4"], 90, belowtext + 21);
		buttons[CANCEL] = std::make_unique<MapleButton>(src["BtCancel4"], 132, belowtext + 21);

		Rectangle<int16_t> area(26, 232, belowtext, belowtext + 20);
		numfield = Textfield(Text::A11M, Text::LEFT, Text::LIGHTGREY, area, 9);
		numfield.set_state(Textfield::FOCUSED);
		numfield.change_text(std::to_string(de));
		numfield.set_enter_callback([&](std::string numstr){
			handlestring(numstr);
		});
	}
Exemplo n.º 2
0
	UICharcreation::UICharcreation()
	{
		female = Session::get().getlogin().getaccount().female;

		nl::node src = nl::nx::ui["Login.img"];
		nl::node bgsrc = nl::nx::map["Back"]["login.img"]["back"];
		nl::node crsrc = src["NewChar"];

		sky = bgsrc["2"];
		cloud = bgsrc["27"];

		sprites.emplace_back(bgsrc["15"], Point<int16_t>(153, 685));
		sprites.emplace_back(bgsrc["16"], Point<int16_t>(200, 400));
		sprites.emplace_back(bgsrc["17"], Point<int16_t>(160, 263));
		sprites.emplace_back(bgsrc["18"], Point<int16_t>(349, 1220));
		sprites.emplace_back(src["Common"]["frame"], Point<int16_t>(400, 290));

		nameboard = crsrc["charName"];

		lookboard.emplace_back(crsrc["charSet"], Point<int16_t>(450, 115));
		lookboard.emplace_back(crsrc["avatarSel"]["0"]["normal"], Point<int16_t>(461, 217));
		lookboard.emplace_back(crsrc["avatarSel"]["1"]["normal"], Point<int16_t>(461, 236));
		lookboard.emplace_back(crsrc["avatarSel"]["2"]["normal"], Point<int16_t>(461, 255));
		lookboard.emplace_back(crsrc["avatarSel"]["3"]["normal"], Point<int16_t>(461, 274));
		lookboard.emplace_back(crsrc["avatarSel"]["4"]["normal"], Point<int16_t>(461, 293));
		lookboard.emplace_back(crsrc["avatarSel"]["5"]["normal"], Point<int16_t>(461, 312));
		lookboard.emplace_back(crsrc["avatarSel"]["6"]["normal"], Point<int16_t>(461, 331));
		lookboard.emplace_back(crsrc["avatarSel"]["7"]["normal"], Point<int16_t>(461, 350));
		lookboard.emplace_back(crsrc["avatarSel"]["8"]["normal"], Point<int16_t>(461, 369));

		buttons[BT_CHARC_OK] = std::make_unique<MapleButton>(crsrc["BtYes"], Point<int16_t>(482, 292));
		buttons[BT_CHARC_CANCEL] = std::make_unique<MapleButton>(crsrc["BtNo"], Point<int16_t>(555, 292));
		buttons[BT_CHARC_FACEL] = std::make_unique<MapleButton>(crsrc["BtLeft"], Point<int16_t>(521, 216));
		buttons[BT_CHARC_FACER] = std::make_unique<MapleButton>(crsrc["BtRight"], Point<int16_t>(645, 216));
		buttons[BT_CHARC_HAIRL] = std::make_unique<MapleButton>(crsrc["BtLeft"], Point<int16_t>(521, 235));
		buttons[BT_CHARC_HAIRR] = std::make_unique<MapleButton>(crsrc["BtRight"], Point<int16_t>(645, 235));
		buttons[BT_CHARC_HAIRCL] = std::make_unique<MapleButton>(crsrc["BtLeft"], Point<int16_t>(521, 254));
		buttons[BT_CHARC_HAIRCR] = std::make_unique<MapleButton>(crsrc["BtRight"], Point<int16_t>(645, 254));
		buttons[BT_CHARC_SKINL] = std::make_unique<MapleButton>(crsrc["BtLeft"], Point<int16_t>(521, 273));
		buttons[BT_CHARC_SKINR] = std::make_unique<MapleButton>(crsrc["BtRight"], Point<int16_t>(645, 273));
		buttons[BT_CHARC_TOPL] = std::make_unique<MapleButton>(crsrc["BtLeft"], Point<int16_t>(521, 292));
		buttons[BT_CHARC_TOPR] = std::make_unique<MapleButton>(crsrc["BtRight"], Point<int16_t>(645, 292));
		buttons[BT_CHARC_BOTL] = std::make_unique<MapleButton>(crsrc["BtLeft"], Point<int16_t>(521, 311));
		buttons[BT_CHARC_BOTR] = std::make_unique<MapleButton>(crsrc["BtRight"], Point<int16_t>(645, 311));
		buttons[BT_CHARC_SHOESL] = std::make_unique<MapleButton>(crsrc["BtLeft"], Point<int16_t>(521, 330));
		buttons[BT_CHARC_SHOESR] = std::make_unique<MapleButton>(crsrc["BtRight"], Point<int16_t>(645, 330));
		buttons[BT_CHARC_WEPL] = std::make_unique<MapleButton>(crsrc["BtLeft"], Point<int16_t>(521, 349));
		buttons[BT_CHARC_WEPR] = std::make_unique<MapleButton>(crsrc["BtRight"], Point<int16_t>(645, 348));
		buttons[BT_CHARC_GENDERL] = std::make_unique<MapleButton>(crsrc["BtLeft"], Point<int16_t>(521, 368));
		buttons[BT_CHARC_GEMDERR] = std::make_unique<MapleButton>(crsrc["BtRight"], Point<int16_t>(645, 368));

		buttons[BT_CHARC_FACEL]->setactive(false);
		buttons[BT_CHARC_FACER]->setactive(false);
		buttons[BT_CHARC_HAIRL]->setactive(false);
		buttons[BT_CHARC_HAIRR]->setactive(false);
		buttons[BT_CHARC_HAIRCL]->setactive(false);
		buttons[BT_CHARC_HAIRCR]->setactive(false);
		buttons[BT_CHARC_SKINL]->setactive(false);
		buttons[BT_CHARC_SKINR]->setactive(false);
		buttons[BT_CHARC_TOPL]->setactive(false);
		buttons[BT_CHARC_TOPR]->setactive(false);
		buttons[BT_CHARC_BOTL]->setactive(false);
		buttons[BT_CHARC_BOTR]->setactive(false);
		buttons[BT_CHARC_SHOESL]->setactive(false);
		buttons[BT_CHARC_SHOESR]->setactive(false);
		buttons[BT_CHARC_WEPL]->setactive(false);
		buttons[BT_CHARC_WEPR]->setactive(false);
		buttons[BT_CHARC_GENDERL]->setactive(false);
		buttons[BT_CHARC_GEMDERR]->setactive(false);

		Rectangle<int16_t> txfae = Rectangle<int16_t>(
			Point<int16_t>(490, 219),
			Point<int16_t>(630, 243)
			);
		namechar = Textfield(Text::A13M, Text::LEFT, Text::WHITE, txfae, 12);
		namechar.setstate(Textfield::FOCUSED);

		UI::get().focustextfield(&namechar);

		facename = Text(Text::A11M, Text::CENTER, Text::BLACK);
		hairname = Text(Text::A11M, Text::CENTER, Text::BLACK);
		haircname = Text(Text::A11M, Text::CENTER, Text::BLACK);
		bodyname = Text(Text::A11M, Text::CENTER, Text::BLACK);
		topname = Text(Text::A11M, Text::CENTER, Text::BLACK);
		botname = Text(Text::A11M, Text::CENTER, Text::BLACK);
		shoename = Text(Text::A11M, Text::CENTER, Text::BLACK);
		wepname = Text(Text::A11M, Text::CENTER, Text::BLACK);
		gendername = Text(Text::A11M, Text::CENTER, Text::BLACK);

		nl::node mkinfo = nl::nx::etc["MakeCharInfo.img"]["Info"];
		for (int32_t i = 0; i < 2; i++)
		{
			bool f;
			nl::node mk_n;
			if (i == 0)
			{
				f = true;
				mk_n = mkinfo["CharFemale"];
			}
			else
			{
				f = false;
				mk_n = mkinfo["CharMale"];
			}

			for (auto subnode : mk_n)
			{
				int num = stoi(subnode.name());
				for (auto idnode : subnode)
				{
					int value = idnode;
					switch (num)
					{
					case 0:
						faces[f].push_back(value);
						break;
					case 1:
						hairs[f].push_back(value);
						break;
					case 2:
						haircolors[f].push_back(static_cast<uint8_t>(value));
						break;
					case 3:
						skins[f].push_back(static_cast<uint8_t>(value));
						break;
					case 4:
						tops[f].push_back(value);
						break;
					case 5:
						bots[f].push_back(value);
						break;
					case 6:
						shoes[f].push_back(value);
						break;
					case 7:
						weapons[f].push_back(value);
						break;
					}
				}
			}
		}

		randomizelook();

		newchar.setflip(true);

		position = Point<int16_t>(0, 0);
		dimension = Point<int16_t>(800, 600);
		active = true;
		cloudfx = 200.0f;
	}