void CUICellItem::PushChild(CUICellItem* c) { R_ASSERT(c->ChildsCount()==0); VERIFY (this!=c); m_childs.push_back (c); UpdateItemText (); }
ServerListItem::ServerListItem(ServerData& data) : BStringItem("") { state = data.state; serverName = data.serverName; port = data.port; UpdateItemText(); }
void CPageBoatyard::StartOneTask() { UpdateData(TRUE); int sel = entry_tasks_[0].index; CString info; assert(sel >= 0 && sel < boat_keeper_->Size()); //ms high_produce_timer_.Init(Boats_Entry(sel)->GetProduceTime() * 1000 * entry_tasks_[0].number); info = high_produce_timer_.ToCString(); GetDlgItem(IDC_STA_RESEARCH_TIMER)->SetWindowText(info); //set TIMER_BASE_HIGH_FREQUENCY ms timer counter_ = 0L; SetTimer(TIMER_PRODUCE_BOAT , TIMER_BASE_HIGH_FREQUENCY , NULL); cur_produce_index = sel; //buffer resource for cancel buff_cosume_metal = Boats_Entry(sel)->GetProduceMinal() * entry_tasks_[0].number; buff_cosume_cryst = Boats_Entry(sel)->GetProduceCrystal() * entry_tasks_[0].number; buff_cosume_diplo = Boats_Entry(sel)->GetProduceDiplogen() * entry_tasks_[0].number; is_producing_ = true; SetWorkFlag(true); tip_ = "船厂:0%%"; UpdateItemText(); }
void CPageBoatyard::CancelCurrentProducing() { GetDataPtr()->IncreaseResource(buff_cosume_metal , buff_cosume_cryst , buff_cosume_diplo); GetCommander()->Notify_Resource_Changed(); is_producing_ = false; SetWorkFlag(false); UpdateItemText(); }
void wxMenuItem::SetItemLabel(const wxString& text) { // don't do anything if label didn't change if ( m_text == text ) return; wxMenuItemBase::SetItemLabel(text); UpdateItemText() ; }
CUICellItem* CUICellItem::PopChild() { CUICellItem* itm = m_childs.back(); m_childs.pop_back (); std::swap (itm->m_pData, m_pData); UpdateItemText (); R_ASSERT (itm->ChildsCount()==0); itm->SetOwnerList (NULL); return itm; }
void CPageBoatyard::OnTimer(UINT nIDEvent) { //research if(nIDEvent == TIMER_PRODUCE_BOAT) { ++counter_; if((counter_ >= ulong(Boats_Entry(cur_produce_index)->GetProduceTime() * (1000 / TIMER_BASE_HIGH_FREQUENCY))) && entry_tasks_[0].number > 0) { counter_ = 0L; Boats_Entry(cur_produce_index)->ProduceShips(1); GetCommander()->Notify_Ships_Produced(cur_produce_index , 1); GetCommander()->Notify_Resource_Consumed(Boats_Entry(cur_produce_index)->GetProduceMinal() + Boats_Entry(cur_produce_index)->GetProduceCrystal() + Boats_Entry(cur_produce_index)->GetProduceDiplogen()); entry_tasks_[0].number--; UpdateItemText(); CString info; info.Format("%d" , entry_tasks_[0].number); m_ProgressList.SetItemText(0 , 2 , info); buff_cosume_metal = Boats_Entry(cur_produce_index)->GetProduceMinal() * entry_tasks_[0].number; buff_cosume_cryst = Boats_Entry(cur_produce_index)->GetProduceCrystal() * entry_tasks_[0].number; buff_cosume_diplo = Boats_Entry(cur_produce_index)->GetProduceDiplogen() * entry_tasks_[0].number; } //TIMER_BASE_HIGH_FREQUENCY ms high_produce_timer_.Go(TIMER_BASE_HIGH_FREQUENCY); CString info = high_produce_timer_.ToCString(); GetDlgItem(IDC_STA_RESEARCH_TIMER)->SetWindowText(info); double r = (high_produce_timer_.GetElapseMSecond() / (high_produce_timer_.GetLeftMSecond() + high_produce_timer_.GetElapseMSecond())); tip_.Format("船厂:%0.0f%%" , r * 100.0); CString s; s.Format("%.3f%%" , r * 100.0); m_ProgressList.SetItemText(0 , 3 , s); if(high_produce_timer_.IsZero() || entry_tasks_[0].number == 0) { counter_ = 0L; KillTimer(TIMER_PRODUCE_BOAT); EndOneTask(); //start again if(!entry_tasks_.empty()) { StartOneTask(); } //finish all task else { GetDlgItem(IDC_STA_RESEARCH_TIMER)->SetWindowText(""); } } } CPageIcon::OnTimer(nIDEvent); }
void CPageBoatyard::EndOneTask() { is_producing_ = false; SetWorkFlag(false); entry_tasks_.erase(entry_tasks_.begin()); m_ProgressList.DeleteItem(0); UpdateIndex(); UpdateItemText(); int sel = int(m_ProgressList.GetFirstSelectedItemPosition()) - 1; GetDlgItem(IDC_BTN_CANCEL)->EnableWindow(sel >= 0 && sel < entry_tasks_.size()); if(entry_tasks_.empty() && (!GetCommander()->IsSilentMode())) TipWarpper::Instance().ShowTip("飞船生产任务全部完成"); }
void CPageBoatyard::CancelProducingByIndex(int index) { assert(index >= 0 && index < entry_tasks_.size()); int ship_type = entry_tasks_[index].index; UINT ship_num = entry_tasks_[index].number; double metal = Boats_Entry(ship_type)->GetProduceMinal() * ship_num; double cryst = Boats_Entry(ship_type)->GetProduceCrystal() * ship_num; double diplo = Boats_Entry(ship_type)->GetProduceDiplogen() * ship_num; GetDataPtr()->IncreaseResource(metal , cryst , diplo); GetCommander()->Notify_Resource_Changed(); UpdateItemText(); }
void CPageBoatyard::Notify_Resource_Changed() { if(m_hWnd == NULL) return; UpdateItemText(); int sel = m_list.GetSelectedItem(); if(m_list.GetSelectedItem() != NONE_SELECTED) { GetDlgItem(IDC_BTN_RESEARCH)->EnableWindow(Boats_Entry(sel)->CanProduce() && IsResourceEnough(sel)); GetDlgItem(IDC_EDIT1)->EnableWindow(Boats_Entry(sel)->CanProduce() && IsResourceEnough(sel)); } else { GetDlgItem(IDC_BTN_RESEARCH)->EnableWindow(FALSE); GetDlgItem(IDC_EDIT1)->EnableWindow(FALSE); } }
void CUIInventoryCellItem::Update() { inherited::Update (); UpdateItemText(); u32 color = GetColor(); if ( IsHelper() && !ChildsCount() ) { color = 0xbbbbbbbb; } else if ( IsHelperOrHasHelperChild() ) { color = 0xffffffff; } SetColor(color); }
CUICellItem* CUICellItem::PopChild(CUICellItem* needed) { CUICellItem* itm = m_childs.back(); m_childs.pop_back (); if(needed) { if(itm!=needed) std::swap (itm->m_pData, needed->m_pData); }else { std::swap (itm->m_pData, m_pData); } UpdateItemText (); R_ASSERT (itm->ChildsCount()==0); itm->SetOwnerList (NULL); return itm; }
void ServerListItem::SetServer (const char *newServer) { serverName = newServer; UpdateItemText (); }
void ServerListItem::SetState (uint32 newState) { state = newState; UpdateItemText (); }
void ServerListItem::SetPort (uint32 newPort) { port = newPort; UpdateItemText (); }
void CPageBoatyard::Notify_Ships_Changed() { if(m_hWnd != NULL) UpdateItemText(); }