Example #1
0
void winTrade_t::onTradeUpdate(bool ack)
{
	Container* container;
	glictContainer* pnlContainer;
	PanelList* pnlList;
	uint32_t flag;
	if(ack){ //left side
		container = Containers::getInstance().getTradeContainerAck();
		lblNameLeft.SetCaption(container->getName());
		pnlContainer = &pnlContainerLeft;
		pnlList = &pnlItemsLeft;
		m_leftSideSet = true;
		flag = 1;
	}
	else{ //right side
		container = Containers::getInstance().getTradeContainer();
		lblNameRight.SetCaption(container->getName());
		pnlContainer = &pnlContainerRight;
		pnlList = &pnlItemsRight;
		m_rightSideSet = true;
		flag = 0;
	}

	float height = 4 + (36*ceil(container->getCapacity()/2.));
	pnlContainer->SetVirtualSize(80, height);
	pnlContainer->SetHeight(72);

	for(uint32_t i = 0; i != container->getCapacity(); ++i)
    {
        ItemPanel* panel = new ItemPanel(container, i, Position(0,0,0), i);
        panel->SetPos(5 + ((i % 2) * 36), 4 + (std::floor(i / 2.0f) * 36));
        panel->SetOnClick(tradeItemOnClick);
        //panel->SetOnPaint(tradeItemOnPaint);
		panel->SetOnMouseUp(NULL);
		panel->SetOnMouseDown(NULL);
        panel->SetCustomData((void*)(i*2 | flag));

        pnlContainer->AddObject(panel);
        pnlList->push_back(panel);
    }

    //update buttons
	if(m_leftSideSet && !m_rightSideSet){
		btnReject.SetVisible(true);
		btnReject.SetCaption(gettext("Cancel"));
		btnAccept.SetVisible(false);
		lblWait.SetCaption(gettext("Wait for a counter offer."));
		lblWait.SetVisible(true);
	}
	else if(m_rightSideSet){
		btnReject.SetVisible(true);
		btnReject.SetCaption("Reject");
		btnAccept.SetVisible(true);
		lblWait.SetVisible(false);
	}
}
void AbsorberPanel::addPanelsToList(PanelList& list)
{
	Quadrangle flatP;

	// make panels and add to model list and panel list

	double delta_L = length/this->numLength;
	double delta_W = width/this->numWidth;

	for(int i=0; i<this->numLength;i++)
	{
		for (int j=0; j<this->numWidth;j++)
		{
			double L1 =i*delta_L-length/2;
			double L2 =(i+1)*delta_L-length/2;
			double W2 =(j+1)*delta_W-width/2;
			double W1 = j*delta_W-width/2;

			makeQuadranglefromRectangle(flatP, L1, L2, W1, W2, 0, 0, this->rotation, this->position);
			Panel * FlP = new Panel(this, flatP);

			list.push_back(FlP);
		}
	}
}
Example #3
0
void AbsorberBox::addPanelsToList(PanelList& panelList)
{
	double x = this->dimension.x/2.0;
	double y = this->dimension.y/2.0;
	double z = this->dimension.z/2.0;

	//double a = this->absorbtion;
	/*double r = 1-a;
	double t = this->transparency;
	double nDir = this->normalDirection;*/
	Quadrangle flatP;

	//panelCount++;

	Panel * FlP = new Panel(this, flatP);

	// make panels and add to model list and panel list

	Vector3 n1, n2, n3, n4, s1, s2, s3, s4;
	s1.x = -x+this->position.x; s1.y=-y+this->position.y; s1.z=-z+this->position.z;
	s2.x = -x+this->position.x; s2.y= y+this->position.y; s2.z=-z+this->position.z;
	s3.x =  x+this->position.x; s3.y= y+this->position.y; s3.z=-z+this->position.z;
	s4.x =  x+this->position.x; s4.y=-y+this->position.y; s4.z=-z+this->position.z;
	n1.x = -x+this->position.x; n1.y=-y+this->position.y; n1.z= z+this->position.z;
	n2.x = -x+this->position.x; n2.y= y+this->position.y; n2.z= z+this->position.z;
	n3.x =  x+this->position.x; n3.y= y+this->position.y; n3.z= z+this->position.z;
	n4.x =  x+this->position.x; n4.y=-y+this->position.y; n4.z= z+this->position.z;

	if (this->isBottomChecked)
	{
		flatP.p1=s1; flatP.p2=s2; flatP.p3=s3; flatP.p4=s4;
		FlP = new Panel(this, flatP);                // bottom
		panelList.push_back(FlP);
	}
	 
	if (this->isTopChecked)
	{
		flatP.p1=n1; flatP.p2=n2; flatP.p3=n3; flatP.p4=n4;
		FlP = new Panel(this, flatP);                // top
		panelList.push_back(FlP);
	}

	flatP.p1=s1; flatP.p2=s2; flatP.p3=n2; flatP.p4=n1;
	FlP = new Panel(this, flatP);                // left
	panelList.push_back(FlP);

	flatP.p1=s4; flatP.p2=s3; flatP.p3=n3; flatP.p4=n4;
	FlP = new Panel(this, flatP);                // right
	panelList.push_back(FlP);

	flatP.p1=s2; flatP.p2=n2; flatP.p3=n3; flatP.p4=s3;
	FlP = new Panel(this, flatP);                // back
	panelList.push_back(FlP);

	flatP.p1=s1; flatP.p2=n1; flatP.p3=n4; flatP.p4=s4;
	FlP = new Panel(this, flatP);                // front
	panelList.push_back(FlP);
}