/*---------------------------------------------------------------------*//**
	アイテムをユニット化
	※	ソウマから装備アイテムをフォーカスできるようにユニット化する
**//*---------------------------------------------------------------------*/
void ItemEquip::unitization(s32 ieqp, Item* item, u16 spid)
{
	UnitManager* unitmng = Game::getGame()->getUnitManager(); ASSERT(unitmng != 0L);

	// 既にあるユニットを一度削除
	if(_uidarrEq[ieqp] != 0)
	{
		Unit* unit = unitmng->getUnitFromId(_uidarrEq[ieqp]);
		if(unit != 0)
		{
			ASSERT(unit->getUnitType() == UNITTYPE_EQUIPMENT_ITEM);
			// 一度削除する
			unitmng->removeUnit(unit);
		}
		_uidarrEq[ieqp] = 0;
	}

	// アイテムを外した場合はここで抜ける
	if(item == 0L)	{	return;	}

	// アイテムユニットを作成
	EquipmentItemUnit* itmu = new EquipmentItemUnit();
	ASSERT(itmu != 0L);
	itmu->create(item, _unitOwner, spid);

	// ユニットマネージャに追加
	if(unitmng->addUnit(itmu))
	{
		_uidarrEq[ieqp] = itmu->getUnitId();
	}
}
void WaveManager::update(float dt)
{
	if (curWave < (int)waveList.size())
	{
		//Wave
		if (waveTime <= dt)
		{
			curWave++;
			if (curWave < (int)waveList.size())
			{
				//log("Wave---%d", curWave);
				monsterTime = 0;
				curMonster = 0;
				waveTime += waveList[curWave].WaveTime;
			}
			else{
				log("Wave End");
			}
		}
		waveTime -= dt;

		//Monster
		if (monsterTime <= dt)
		{
			if (curMonster < (int)waveList[curWave].wavedata.size()){
				//log("Monster---%d", curMonster);

				UnitManager* objMgr = UnitManager::getInstance();
				Monster* monster = new Monster(
					waveList[curWave].wavedata[curMonster].MonsterID, 
					monsterPath[waveList[curWave].wavedata[curMonster].PathID]);

				//monster->setParent(objMgr->getLayer());
				//auto sprite = Sprite::createWithSpriteFrameName("blank.png");
				//sprite->setAnchorPoint(Vec2(0, 1));
				//Size sizes(32, 32);
				//sprite->setContentSize(sizes);
				//monster->bindSprite(sprite);
				monster->setActorName("m001");
				objMgr->addUnit(monster);


				monsterTime += waveList[curWave].wavedata[curMonster].NextDalay;
				curMonster++;
			}
			else{
				//log("Monster End");
				monsterTime += 999999;
			}
		}
		monsterTime -= dt;
	}
}
/*---------------------------------------------------------------------*//**
	ユニット化した装備品を得る
**//*---------------------------------------------------------------------*/
Unit* ItemEquip::getEquipUnit(s32 ieqp) const
{
	ASSERT((0 <= ieqp) && (ieqp < EquipPlace::NUM_EQP));
	if(_uidarrEq[ieqp] == 0)
	{
		return 0L;
	}

	UnitManager* unitmng = Game::getGame()->getUnitManager(); ASSERT(unitmng != 0L);
	Unit* unit = unitmng->getUnitFromId(_uidarrEq[ieqp]);
	return unit;
}
/*---------------------------------------------------------------------*//**
	デシリアライズ(セーブデータ読み込み)通知
**//*---------------------------------------------------------------------*/
void FocusCursor::notifyDeserialize()
{
	// フォーカスを復帰
	UnitManager* unitmng = Game::getGame()->getUnitManager();	ASSERT(unitmng != 0L);
	for(int i = 0; i < unitmng->getUnitNum(); i++)
	{
		Unit* unit = unitmng->getUnitFromIndex(i); ASSERT(unit != 0L);
		if(unit->isGuiFocused())
		{
			setFocus(0, unit);
		}
	}
}
/*---------------------------------------------------------------------*//**
	フレーム制御
**//*---------------------------------------------------------------------*/
void StMod10401::exec(ExecRes* res, const ExecCtx* ec)
{
	if(Game::getGame()->getMoveMap()->getCurMapId() == MapIdDef::MAPID_EP01_FOREST4_EXIT_SQUARE)	// シネンの森出口広場マップ
	{
		SaveData* svd = Game::getGame()->getSaveSys()->getSaveData(); ASSERT(svd != 0L);
		if(	svd->getSaveF(SaveIdDef::SFID_ST10401_DONE_YASAN_THANK) &&	// ヤサンイベントが終わっている
			!svd->getSaveF(SaveIdDef::SFID_ST10204_MEET_KOTSUME) )		// コツメが合流していない
		{
			UnitManager* unitmng = Game::getGame()->getUnitManager(); ASSERT(unitmng != 0L);
			if(!unitmng->checkEnableEnemy())	// 有効な敵がいない場合のみ
			{
				// キャラクタの位置によってイベント起動
				const PcUnit* unitLeader = Game::getGame()->getMyParty()->getLeaderPcUnit();
				if(unitLeader != 0L)
				{
					const Vector3F* posLeader = unitLeader->getPosition();
					if(posLeader->x() <= 2700.0f)	// 大猿に近づいた
					{
						// 次のイベント起動確認
						do
						{
							// 通常歩行時以外(ソウマ詠唱中や対決中など)は失敗
							GameMode::ModeKind kindEnd = Game::getGame()->getGameMode()->getChildEndModeKind();
							if(kindEnd != GameMode::MODE_GAME_INGAME_WALKING_NORMAL)	{	break;	}

							Party* party = Game::getGame()->getMyParty();
							// アサダウン中は失敗
							if(party->getPcUnit(MyParty::PC_MY)->getCharStat()->getStat() != CharStat::STAT_ALIVE)	{	break;	}
							// コルポダウン中は失敗
							if(party->getPcUnit(MyParty::PC_PTN)->getCharStat()->getStat() != CharStat::STAT_ALIVE)	{	break;	}

							// イベント起動
							EventSys* evsys = Game::getGame()->getEventSys(); ASSERT(evsys != 0L);
							EvCause evcause(EventCause::CID_NULL);
							evsys->begin(EVID_KOTSUME_MEET_AGAIN, 0, &evcause);
						}
						while(false);
					}
				}
			}
		}
	}

	StMod10000::exec(res, ec);
}
/*---------------------------------------------------------------------*//**
	動作開始
**//*---------------------------------------------------------------------*/
void ShowObj::play(ActMatter* owner)
{
	// ユニットを取得する
	Unit* unit = 0L;
	if((_evidCtrlTrg != 0) || (_charidTrg != 0))
	{
		UnitManager* unitmng = Game::getGame()->getUnitManager(); ASSERT(unitmng != 0L);
		unit = unitmng->findCharUnitFromCtrlEvidOrCharId(_evidCtrlTrg, _charidTrg);
	}

	// ユニット有効・無効の設定
	if(unit != 0L)
	{
		unit->setEnable(_show);
	}

	Act::play(owner);
}
Example #7
0
ScriptWorld::ScriptWorld(Allocator& a, UnitManager& um, ResourceManager& rm, LuaEnvironment& le, World& w)
	: _marker(SCRIPT_WORLD_MARKER)
	, _script(a)
	, _data(a)
	, _map(a)
	, _cache(a)
	, _unit_manager(&um)
	, _resource_manager(&rm)
	, _lua_environment(&le)
	, _world(&w)
{
	um.register_destroy_function(script_world_internal::unit_destroyed_callback_bridge, this);
}
Example #8
0
void HeartbeatArrival(uint16_t sourceId, CANExtended::DeviceState state)
{
#ifdef DEBUG_PRINT
	static int dc =0;
#endif
	if (state != CANExtended::Operational)
		return;
	CanEx->Sync(sourceId, SYNC_LIVE, CANExtended::Trigger); //Confirm & Stop
	if (sourceId & 0x100)
	{
		boost::shared_ptr<ShelfUnit> unit = unitManager.FindUnit(sourceId);
		if (unit.get() == NULL)
		{
#ifdef DEBUG_PRINT
			cout<<"#"<<++dc<<" DeviceID: "<<(sourceId & 0xff)<<" Added"<<endl;
#endif
			unit.reset(new ShelfUnit(*CanEx, sourceId));
			CanEx->AddDevice(unit);
//			unit->ReadCommandResponse.bind(ethEngine.get(), &NetworkEngine::DeviceReadResponse);
//			unit->WriteCommandResponse.bind(ethEngine.get(), &NetworkEngine::DeviceWriteResponse);
			unitManager.Add(sourceId, unit);
		}
	}
}
Example #9
0
static void UpdateUnits(void const *argument)  //Prevent missing status
{
	osDelay(2000);
	std::map<std::uint16_t, boost::shared_ptr<ShelfUnit> > &unitList = unitManager.GetList();
	//CanEx->SyncAll(SYNC_DATA, CANExtended::Trigger);
	for(UnitManager::UnitIterator it = unitList.begin(); it!= unitList.end(); ++it)
	{
		if (!it->second->IsBusy())
		{
			CanEx->Sync(it->second->DeviceId, SYNC_DATA, CANExtended::Trigger);
			osDelay(20);
		}
	}
	while(1)
	{
		if (ethEngine.get()!=NULL)
			ethEngine->InventoryRfid();
		osDelay(100);
	}
}
Example #10
0
/*---------------------------------------------------------------------*//**
	コマンドフレーム処理 - アイテムを拾う
**//*---------------------------------------------------------------------*/
int PcRole::execCommand_pickupItem(ExecRes* res, const ExecCtx* ec, const CmdParam* param)
{
	const int	STEP_ANIM_START		= 1;
	const int	STEP_ANIM_WAIT		= 2;
	const int	END					= 999;
	
	int step = param->_step;

	switch(step)
	{
	case STEP_ANIM_START:

		step = STEP_ANIM_WAIT;

		{
			// アイテムの空き確認
			ItemManager* itmmng = Game::getGame()->getMyParty()->getItemManager(); ASSERT(itmmng != 0L);
			if(itmmng->getEmptyItemIndex(false) == -1)
			{
				res->setDone();	// この時点で空きがなかったら失敗
				return END;
			}

			// アニメーション変更
			_sprtRef->pcUnit()->changeAnim(CharUnit::ANIMID_PICKUP_ITEM, false);
		}

		break;

	case STEP_ANIM_WAIT:
		if(param->_frmcntStep >= 20.0f)	// 実行フレーム
		{
			// 対象アイテム取得
			FieldItemUnit* fiunit = 0L;
			const ItemDef* itmdf = 0L;
			do
			{
				u16 unitidRsvPickup = _sprtRef->getReservedBefaviorParameter();
				if(unitidRsvPickup == 0)	{	break;	}
				UnitManager* unitmng = Game::getGame()->getUnitManager();	ASSERT(unitmng != 0L);
				Unit* unit = unitmng->getUnitFromId(unitidRsvPickup);
				if((unit == 0L) || (unit->getUnitType() != UNITTYPE_FIELD_ITEM))	{	break;	}
				fiunit = (FieldItemUnit*)unit;
				itmdf = fiunit->getItemDef();
			}
			while(false);
			if(itmdf == 0L)
			{
				res->setDone();
				return END;
			}

			// アイテムを拾う
			ItemManager* itmmng = Game::getGame()->getMyParty()->getItemManager(); ASSERT(itmmng != 0L);
			if(itmmng->pickupItem(Game::getGame()->getMap(), fiunit->getPlacementObj(), fiunit->getEleneStat()))
			{
				// 成功時
				fiunit->setEnable(false);	// ユニット無効化

				// メッセージを表示する
				VcString msg(VcString::format(GameFixedStrTbl::getString(GameFixedStrTbl::SID_GET_SOMETHING)->getRaw(), itmdf->getName(Env_getLangId())->getRaw(), "\n"));
				Game::getGame()->getConductor()->on(&msg, _sprtRef->getPcUnit(), 0);
				// SE
				///Game::getGame()->getSoundManager()->playSe(???, false, 1.0f, _sprtRef->getThisUnit()->getCenterPos(), 0L);
				// 通知発行
				Game::getGame()->getGameNotifier()->notifyPickupItem(_sprtRef->getPcUnit(), fiunit);
				// クエストの可変達成状態の更新
				QuestManager* qsmng = Game::getGame()->getQuestManager();
				qsmng->updateVariableAchievementState();
			}

			step = END;
		}
		break;
		
	case END:
		if(param->_frmcntStep >= 10.0f)
		{
			res->setDone();
		}
		break;
	}

	//STRACE("... use_item ...\n");
	
	return step;
}
/*---------------------------------------------------------------------*//**
	フレーム処理実装
**//*---------------------------------------------------------------------*/
void MapEmp_10242_1701_RestAtHome::execImplement(ExecRes* res, const ExecCtx* ec, f32 frameBegun)
{
    enum Step
    {
        STEP_NULL,
        STEP_WAIT_BEGIN,
        STEP_CHECK_MOTEHR,
        STEP_TALK,
        STEP_WAIT_TALK,
        STEP_WAIT_YESNO,
        STEP_WAIT_FOUT,
        STEP_WAIT_FIN,
    };

    GameGui* gui = Game::getGame()->getGui();
    ASSERT(gui != 0L);
    SubtitlesWindow* wndSbt = gui->getSubtitlesWindow();
    ASSERT(wndSbt != 0L);
    GameSysMsgWindow* wndSysMsg = (GameSysMsgWindow*)gui->getSysMsgWindow();
    ASSERT(wndSysMsg != 0L);
    ScreenEffect* screff = Game::getGame()->getSceneScreenEffect();
    ASSERT(screff != 0L);

    switch(getStep())
    {
    case STEP_WAIT_BEGIN:		// 継続監視
        ///STRACE("!!! WAIT...\n");
        if(!getOwner()->checkBegunOtherMatter(this, true))
        {
            // 自身以外のイベントが起動していないならば次のステップへ
            advanceStep();
        }
        break;
    case STEP_CHECK_MOTEHR:
    {
        UnitManager* unitmng = Game::getGame()->getUnitManager();
        ASSERT(unitmng != 0L);
        // アサの母親在宅チェック
        Unit* unitYu = unitmng->findCharUnitFromCharId(CharIdDef::CHARID_NPC_MOTHER);
        _isShowMotherMsg = (unitYu != 0L);

        // 次のステップへ
        advanceStep();
    }
    break;
    case STEP_TALK:
    {
        if(_isShowMotherMsg)
        {
            // メッセージを得る
            EventData* evdat = getOwner()->getEventData();
            ASSERT(evdat != 0L);
            const MsgDataSet* msgdatset = evdat->getMsgDataSet();
            ASSERT(msgdatset != 0L);
            const MsgData::Msg* msg = msgdatset->findMessageFromMsgid(MSGID_TALK_MSG);
            const VcString strMsg = (msg != 0L) ? msgdatset->getString(msg) : "";
            // 会話メッセージウインドウを表示する
            wndSbt->setKind(SubtitlesWindow::KIND_TALK);
            wndSbt->showMessage(&strMsg, MSGWND_CTRL_HINT);

            // 次のステップへ
            advanceStep();
        }
        else
        {
            if(frameBegun > (1.0f * FRAMERATE))	// ちょっと待って
            {
                // 次のステップへ
                advanceStep();
            }
        }
    }
    break;
    case STEP_WAIT_TALK:
        if(wndSbt->isDone() || (!_isShowMotherMsg))
        {
            // ウインドウを閉じる
            wndSbt->showWindow(false);

            // メッセージを得る
            EventData* evdat = getOwner()->getEventData();
            ASSERT(evdat != 0L);
            const MsgDataSet* msgdatset = evdat->getMsgDataSet();
            ASSERT(msgdatset != 0L);
            const MsgData::Msg* msg = msgdatset->findMessageFromMsgid(MSGID_INQURE);
            const VcString strMsg = (msg != 0L) ? msgdatset->getString(msg) : "";
            // YES / NO メッセージウインドウを表示する
            wndSysMsg->setKind(MessageWindow::KIND_YESNO);
            wndSysMsg->showMessage(&strMsg, MSGWND_CTRL_HINT);

            // 次のステップへ
            advanceStep();
        }
        break;
    case STEP_WAIT_YESNO:
    {
        const GameSysMsgWindow::Result* res = wndSysMsg->getResult();
        if(res->isClickYesButton())
        {
            // ウインドウを閉じる
            wndSysMsg->showWindow(false);
            // フェードアウト
            ColorU8 col1(0, 0, 0, 255);
            screff->setColor1(&col1);
            screff->setMaxFrame(120);
            screff->start(ScreenEffect::MODE_FADE_OUT);
            // 次のステップへ
            advanceStep();
        }
        else if(res->isClickNoButton())
        {
            // ウインドウを閉じる
            wndSysMsg->showWindow(false);
            // 終了
            end();
        }
    }
    break;
    case STEP_WAIT_FOUT:
        if(!screff->isWorking())
        {
            // 家での休息処理
            restAtHome();
            StoryManager* strymng = Game::getGame()->getStoryManager();
            ASSERT(strymng != 0L);
            strymng->notifyRestAtHome();

            // PSNS にスコア送信
            ScoreBase* score = Game::getGame()->getScore();
            ASSERT(score != 0L);
            score->updatePsnsScore();

            // 休息時イベント起動(たいていは何も起動しない)
            EventSys* evsys = Game::getGame()->getEventSys();
            ASSERT(evsys != 0L);
            EvCause evcause(EventCause::CID_EVENT);
            ///evsys->beginCase(StDepEvDef::ECID_V01_MAP_REST_AT_HOME, 0, &evcause);
            evsys->begin(StDepEvDef::EVID_EP01_MAP_AFTER_REST_AT_HOME, 0, &evcause);

            // フェードインへ
            ColorU8 col1(0, 0, 0, 255);
            screff->setColor1(&col1);
            screff->setMaxFrame(60);
            screff->start(ScreenEffect::MODE_FADE_IN);
            // 次のステップへ
            advanceStep();
        }
        break;
    case STEP_WAIT_FIN:
        if(!screff->isWorking())
        {
            screff->end(0);
            end();
        }
        break;
    }
}
/*---------------------------------------------------------------------*//**
	描画
**//*---------------------------------------------------------------------*/
void FocusCursor::draw(const RenderCtx* rc)
{
	if(!_isEnableOut || !_isEnableSelf)	{	return;	}	// 無効化中
	
	GameRenderCtx* grc = (GameRenderCtx*)rc;
	Renderer* rdr = rc->getRenderer();
	RectF32 uv;

	// テクスチャ設定
	rdr->bindTexture(_texRef);
	// 加算アルファ合成
	rdr->setAlphaBlendFunc(Renderer::AFUNC_ADD);
	// 2D 解像描画比
	f32 rate2dr = Env_get2drRate();
	// 頂点カラーを基本色に
	rdr->setSolidColor(255, 255, 255, 255);

	// クリック対象を描画
	{
		Tfw* tfw = Game::getGame()->getTfw();						ASSERT(tfw != 0L);
		View* view = tfw->getView();								ASSERT(view != 0L);
		SorSgm* sgm = (SorSgm*)tfw->getSgManager();					ASSERT(sgm != 0L);
		Camera* cam = sgm->getVisibleCamera();
		if(cam != 0L)
		{
			UnitManager* unitmng = Game::getGame()->getUnitManager();	ASSERT(unitmng != 0L);
			for(int i = 0; i < unitmng->getUnitNum(); i++)
			{
				const Unit* unit = unitmng->getUnitFromIndex(i); ASSERT(unit != 0L);
				if(!unit->isEnable())				{	continue;	}	// 無効なユニットは除外
				if(!unit->isEnableFocus())			{	continue;	}	// フォーカスされないユニットは除外
				if(unit->isHidden())				{	continue;	}	// 隠し属性ユニットは除外
				if(unit->isHiddenClick())			{	continue;	}	// クリック選択不可
				if(unit->getUnitType() == UNITTYPE_EQUIPMENT_ITEM)	{	continue;	}	// 所持品は除外
				if(unit->getCenterPos()->z() >= cam->getLoc()->z())	{	continue;	}	// カメラより手前は除外

				// 既にフォーカスがあるユニットは不要
				bool isHadFocus = false;
				for(s32 j = 0; j < NUM_FOCUS_MAX; j++)
				{
					if(_focusarr->getUnit(j) == unit)
					{
						isHadFocus = true;
						break;
					}
				}
				if(isHadFocus)						{	continue;	}

				// スクリーン座標に変換
				Vector2F vScr;
				Gcalc::conv3dPosToScreenPos(&vScr, unit->getCenterPos(), cam, view);

				// 画面外チェック
				if(	((vScr.x() + W_FOCUS_CIRC) < 0) ||
					((vScr.x() - W_FOCUS_CIRC) >= Game::getGame()->getLogicalWidth()) ||
					((vScr.y() + H_FOCUS_CIRC) < 0) ||
					((vScr.y() - H_FOCUS_CIRC) >= Game::getGame()->getLogicalHeight()) )
				{
					continue;
				}

				// 描画
				::glPushMatrix();	// 行列を保存
				::glTranslatef(vScr.x(), vScr.y(), 0.0f);
				drawQuestIcon(rdr, unit, rate2dr);	// クエストアイコン表示
				::glRotatef(_dangFocusable, 0.0f, 0.0f, 1.0f);
				// フォーカス可能アイコン表示
				RectF32 vtx(- W_FOCUS_CIRC / 2, - H_FOCUS_CIRC / 2, W_FOCUS_CIRC, H_FOCUS_CIRC);
				RendererUtils::draw2dTextureRect(rdr, &vtx, Gcalc::calcTexUv(&uv, UV_FOCUSABLE, W_TEX, H_TEX, rate2dr));
				::glPopMatrix();	// 行列を戻す
			}
		}
	}

	// フォーカスカーソル表示
	drawFocusCursor(rdr, _focusarr, 1.0f, rate2dr);

	// マジッククラスターのフォーカスを表示
	MagicSys* mgsys = Game::getGame()->getMagicSys();
	for(int i = 0; i < mgsys->getMaxClusterNum(); i++)
	{
		MagicCluster* mc = mgsys->getClusterFromIndex(i);
		if(mc == 0L)			{	continue;	}
		if(!mc->isValid())		{	continue;	}
		if(!TFW_IS_FLAG(mc->getConfFlags(), MagicCluster::CONFF_SHOW_FC))	{	continue;	}
		rdr->setSolidColor(63, 0, 255, 255);
		drawFocusCursor(rdr, mc->getFocusArray(), 0.5f, rate2dr);
	}

	// 通常アルファ合成
	rdr->setAlphaBlendFunc(Renderer::AFUNC_NORMAL);

	// フォーカスゲージ表示
	for(s32 i = 0; i < NUM_FOCUS_MAX; i++)
	{
		const Unit* unitFocused = _focusarr->getUnit(i);
		if(unitFocused == 0L)	{	continue;	}	// フォーカスがある場合のみ以下を処理する
		const Vector2F* posScr = _focusarr->getScreenPos(i);

		f32 x = posScr->x() + W_FOCUS_CIRC * 0.5f;
		f32 y = posScr->y();

		// ゲージ表示
		if(unitFocused->isCategory(Unit::UNITCAT_CHAR))
		{
			const CharUnit* cunit = (CharUnit*)unitFocused;
			const CharStat* cstat = cunit->getCharStat();
			if(cstat != 0L)
			{
				StatusDrawer::drawCharStat(rc, _texRef, cstat, x, y, StatusDrawer::W_GAUGE_DEFAULT, StatusDrawer::H_GAUGE_DEFAULT, false, false);
			}
		}
		else if(unitFocused->getUnitType() == UNITTYPE_EQUIPMENT_ITEM)
		{
			const EquipmentItemUnit* iunit = (EquipmentItemUnit*)unitFocused;
			const Item* item = iunit->getItem();
			if(item != 0L)
			{
				// 名前表示
				const VcString* name = item->getItemDef()->getName(Env_getLangId());
				if(name != 0L)
				{
					rdr->setSolidColor(255, 255, 255, 255);
					Font* fontJp = grc->getFontSet()->getFont(GameFontSet::JP);
					EasyStringDrawer::draw(fontJp, name, x, y, 8, rc);
					y += 8.0f;
				}

				const EleneStat* eestat = item->getEleneStat();
				if(eestat != 0L)
				{
					StatusDrawer::drawEleneStat(rc, _texRef, eestat, x, y, 60.0f, StatusDrawer::H_ENEGAUGE_DEFAULT, false);
				}
			}
		}
		else if(unitFocused->getUnitType() == UNITTYPE_PUT_ITEM)
		{
			const PutItemUnit* diunit = (PutItemUnit*)unitFocused;
			const ItemDef* itmdf = diunit->getItemDef();
			if(itmdf != 0L)
			{
				// 名前表示
				const VcString* name = itmdf->getName(Env_getLangId());
				if(name != 0L)
				{
					rdr->setSolidColor(255, 255, 255, 255);
					Font* fontJp = grc->getFontSet()->getFont(GameFontSet::JP);
					EasyStringDrawer::draw(fontJp, name, x, y, 8, rc);
					y += 8.0f;
				}
			}
			const EleneStat* eestat = diunit->getEleneStat();
			if(eestat != 0L)
			{
				StatusDrawer::drawEleneStat(rc, _texRef, eestat, x, y, 60.0f, StatusDrawer::H_ENEGAUGE_DEFAULT, false);
			}
		}
	}
}
/*---------------------------------------------------------------------*//**
	フレーム制御
**//*---------------------------------------------------------------------*/
void FocusCursor::exec(ExecRes* res, const ExecCtx* ec)
{
	if(!_isEnableOut)	{	return;	}	// 外部からの無効化

	GameExecCtx* gec = (GameExecCtx*)ec;
	TouchPanel* ui = gec->getTouchPanel(); 

	// フォーカスの有効性更新
	_focusarr->updateValidity();
	// フォーカスの座標値をリセット
	for(s32 i = 0; i < NUM_FOCUS_MAX; i++)
	{
		_focusarr->invalidateScreenPos(i);
	}

	// 有効性判定
	_isEnableSelf = !gec->isLockOperating();
	bool isEnableUiReact = _isEnableSelf && !gec->isOpenedLockGui() && !ui->isReacted() && (_fcntPreventTap == 0.0f);

	// タッチ操作による処理
	if(isEnableUiReact) 
	{
		PointF32 ptTouch, ptStart;
		bool isTap = false;
		bool isDblTapRel = false;
		if(!ui->isReacted())
		{
			const f32 DIFF_TAP_RANGE = 20.0f;
			if(ui->isTapRelease(&ptTouch, &ptStart)) { isTap = ptTouch.isNear(&ptStart, DIFF_TAP_RANGE, DIFF_TAP_RANGE); }	// 面積が狭いので、isClickRelease だとストレスに感じる
			if(ui->isDoubleClickRelease(&ptTouch)) { isDblTapRel = true; }
		}
		if(isTap || isDblTapRel)
		{
			Tfw* tfw = Game::getGame()->getTfw();						ASSERT(tfw != 0L);
			View* view = tfw->getView();								ASSERT(view != 0L);
			SorSgm* sgm = (SorSgm*)tfw->getSgManager();					ASSERT(sgm != 0L);
			Camera* cam = sgm->getVisibleCamera();						ASSERT(cam != 0L);

			UnitManager* unitmng = Game::getGame()->getUnitManager();	ASSERT(unitmng != 0L);
			for(int i = 0; i < unitmng->getUnitNum(); i++)
			{
				Unit* unit = unitmng->getUnitFromIndex(i);				ASSERT(unit != 0L);
				if(!unit->isEnable())		{	continue;	}	// 無効なユニットは除外
				if(!unit->isEnableFocus())	{	continue;	}	// フォーカスされないユニットは除外
				if(unit->isHidden())		{	continue;	}	// 隠し属性ユニットは除外
				if(unit->getUnitType() == UNITTYPE_EQUIPMENT_ITEM)	{	continue;	}	// 所持品は除外
				if(unit->getCenterPos()->z() >= cam->getLoc()->z())	{	continue;	}	// カメラより手前は除外

				// スクリーン座標に変換
				Vector2F vScr;
				Gcalc::conv3dPosToScreenPos(&vScr, unit->getCenterPos(), cam, view);

				if(isDblTapRel)	// ダブルクリック時は直接フォーカスをセットする
				{
					// 一度フォーカスをリセット
					for(int j = 0; j < NUM_FOCUS_MAX; j++)
					{
						setFocus(j, 0L, 0L);
					}
					// 範囲内かどうか判定して、範囲内だったらフォーカス設定する
					if(TFW_IS_NEAR(vScr.x(), ptTouch.x(), RANGE_TOTRG) && TFW_IS_NEAR(vScr.y(), ptTouch.y(), RANGE_TOTRG))
					{
						// フォーカスをセット(上部でリセットしているので、[0] 決めうち)
						setFocus(0, unit, &vScr);
						// UI に反応済みフラグを立てる
						ui->setReacted(true);
						break;
					}
				}
				else if(isTap)	// タップ時はメニューを表示
				{
					// 範囲内かどうか判定して、範囲内だったらメニューを表示する
					TRACELN("{FocusCursor::exec} unit touch?; scr_x=%f, scr_y=%f, click_x=%d, click_y=%d", vScr.x(), vScr.y(), ptTouch.x(), ptTouch.y());
					if(TFW_IS_NEAR(vScr.x(), ptTouch.x(), RANGE_TOTRG) && TFW_IS_NEAR(vScr.y(), ptTouch.y(), RANGE_TOTRG))
					{
						showFocusMenu(unit, &vScr);		// フォーカスメニュー表示
						ui->setReacted(true);	// UI に反応済みフラグを立てる
					}
				}
			}
		}
	}

	// フォーカスカーソルの画面位置を計算
	for(s32 i = 0; i < NUM_FOCUS_MAX; i++)
	{
		// 無効になったユニットは外す
		const Unit* unitFocused = _focusarr->getUnit(i);
		if(unitFocused == 0L)	{	continue;	}
		if(!unitFocused->isEnable())
		{
			setFocus(i, 0L, 0L);
		}

		// スクリーン座標値が未計算の場合、計算する
		if(!_focusarr->isValidScreenPos(i))
		{
			_focusarr->calcScreenPos(i);
		}
	}

	// マジッククラスターのフォーカスの画面位置を計算
	MagicSys* mgsys = Game::getGame()->getMagicSys();
	for(int i = 0; i < mgsys->getMaxClusterNum(); i++)
	{
		MagicCluster* mc = mgsys->getClusterFromIndex(i);
		if(mc == 0L)		{	continue;	}
		if(!mc->isValid())	{	continue;	}
		mc->focusArray()->calcScreenPosAll();
	}

	// タップ防止カウンタの更新
	if(_fcntPreventTap > 0.0f)
	{
		_fcntPreventTap -= ec->getDeltaFrame();
		if(_fcntPreventTap < 0.0f)	{	_fcntPreventTap = 0.0f;	}
	}

	// カーソル回転角度の更新
	_dangFocus += DANG_FOCUS_DELTA;
	if(_dangFocus > 180.0f)		{	_dangFocus -= 360.0f;		}
	_dangFocusable += DANG_FOCUSABLE_DELTA;
	if(_dangFocusable > 180.0f)	{	_dangFocusable -= 360.0f;	}
}