void GameLotteryLayer::onBtnRewardCallback(CCObject* pSender) { if (m_bTempSoundOn) { SoundPlayer::play(SNDI_CLICK); } unschedule(schedule_selector(GameLotteryLayer::removeHint)); enableBtns(); // delete hint CCMenuItemSprite* item = static_cast<CCMenuItemSprite*> (pSender); unRegisterMenuItem(item); item->runAction(CCSequence::create( CCCallFunc::create(item, callfunc_selector(CCMenuItemSprite::removeFromParent)), NULL)); m_ptrMenuHint = NULL; // reset circle m_ptrCircle->setRotation(0.0f); // delete the highLight CCNode* ptrLight = m_ptrCircle->getChildByTag(LIGHT_TAG); if(ptrLight) { ptrLight->removeFromParent(); } chargeNewDay(); }
void GameLotteryLayer::onCircleStop() { SoundPlayer::stopAllSounds(); enableBtns(); // result Go button if (m_bIsLotteryNormally) { m_bIsLotteryNormally = false; SoundPlayer::play(SNDI_SLOT_RESULT); // remove old highlight CCNode* ptrLight = m_ptrCircle->getChildByTag(LIGHT_TAG); if(ptrLight) { ptrLight->removeFromParent(); ptrLight = NULL; } // create highlight ptrLight = CREATE_SPRITE(this, "lottery_selected_game.png", true); ptrLight->setTag(LIGHT_TAG); ptrLight->setRotation(CircleHeightLightRotation[m_iCurLottery]); m_ptrCircle->addChild(ptrLight); ptrLight->setPosition(CircleHeightLightPositionX[m_iCurLottery], CircleHeightLightPositionY[m_iCurLottery]); disableBtns(); setGoResult(WIN_CHIPS); animateToShowHint(); scheduleOnce(schedule_selector(GameLotteryLayer::removeHint), 5.0f); } // reset buttons //initBtnGo(); //chargeNewDay(); }
BOOL LoadBedPrf(PAPPDATA pad) { PBEDFILE pbf; BOOL fl; SHORT item; PSZ pszerr = NULL; BOOL rc = FALSE; HWND hlfile = WinWindowFromID(pad->hMain, LB_FILE); HWND hlstr = WinWindowFromID(pad->hMain, LB_STRINGS); ULONG cfiles, cstrings; enum {FILES, FILECMD, TEXTOPT, TEXTFIND, TEXTREPL}; pad->is.working = 1; WinEnableWindow(pad->hMain, FALSE); if (!(pbf = (PBEDFILE)ioF2psz(pad->achload, NULL))) {pszerr = SZERR_ALLOC; goto end;} // controlla versione file profilo batch editor switch (*((PULONG)pbf)) { case BEDPRFID: pad->is.bever = 0; break; case BEDPRFID1: pad->is.bever = 1; break; case BEDPRFID2: pad->is.bever = 2; // text file break; default: goto invalidFile; } /* endswitch */ cfiles = cstrings = 0; // resetta controlli listbox e entryfield ------------------------------ wLboxDelAll(hlfile); WinSetDlgItemText(pad->hMain, EF_FILE, SZ_NULL); wLboxDelAll(hlstr); WinSetDlgItemText(pad->hMain, EF_STRFIND, SZ_NULL); WinSetDlgItemText(pad->hMain, EF_STRREPL, SZ_NULL); // se file testo ------------------------------------------------------- if (pad->is.bever == 2) { PSZ p, pline, pecmd, prepl; FRIDATA fd; CHAR buf[1024]; INT expected; for (p = (PSZ)pbf + sizeof(ULONG), expected = FILES; *p; ) { if (*p == '-') { ++p; switch (expected) { case FILES: if (memcmp(p, "FILES:", 6)) goto invalidFile; expected = FILECMD; break; case FILECMD: if ((*p == 'R') || (*p == '-')) { fl = (*p == 'R'); pline = p + 2; p = nextLine(pline + 2); if (NULL == (pecmd = strrchr(pline, '.'))) goto invalidFile; *pecmd = 0; item = wLboxInsItem(hlfile, LIT_SORTASCENDING, pline); if (fl && item >= 0) { wLboxSetItemHnd(hlfile, item, 1); cfiles++; } /* endif */ continue; } /* endif */ if (memcmp(p, "TEXT:", 5)) goto invalidFile; expected = TEXTOPT; break; case TEXTOPT: if (!memcmp(p, "EI", 2) || !memcmp(p, "IE", 2) || !memcmp(p, "I\r", 2) || !memcmp(p, "E\r", 2) || !memcmp(p, "I\n", 2) || !memcmp(p, "E\n", 2) || (*p == '\r') || (*p == '\n')) { fd.fri.ins = (NULL != memchr(p, 'I', 2)); fd.fri.esc = (NULL != memchr(p, 'E', 2)); expected = TEXTFIND; } else { goto invalidFile; } /* endif */ break; case TEXTFIND: pline = p; p = nextLine(p); if (NULL == (pecmd = strrchr(pline, '.'))) goto invalidFile; *pecmd = 0; fd.fri.cbfind = pecmd - pline; expected = TEXTREPL; continue; case TEXTREPL: prepl = p; p = nextLine(p); if (NULL == (pecmd = strrchr(prepl, '.'))) goto invalidFile; *pecmd = 0; expected = TEXTOPT; memcpy(buf, pline, fd.fri.cbfind); memcpy(buf + fd.fri.cbfind, " -> ", 4); memcpy(buf + fd.fri.cbfind + 4, prepl, pecmd - prepl + 1); if ((item = wLboxInsItem(hlstr, LIT_END, buf)) >= 0) { wLboxSetItemHnd(hlstr, item, fd.ul); cstrings++; } /* endif */ continue; } /* endswitch */ } /* endif */ p = nextLine(p); } /* endfor */ // processa lista file ------------------------------------------------- } else { if (pbf->offset) { // se presente lista file PSZ pflist, pcur; pflist = (PBYTE)pbf + pbf->offset; for (pcur = pflist; *pcur; pcur += strlen(pcur) + 1) { // controllo correttezza file caricato if (!(*pcur == 'R' || *pcur == ' ')) {pszerr = SZERR_INVALIDFILE; goto end;} /* endif */ fl = *pcur++ == 'R'; item = wLboxInsItem(hlfile, LIT_SORTASCENDING, pcur); if (fl && item >= 0) wLboxSetItemHnd(hlfile, item, 1); } /* endfor */ // aggiorna percorso ricerca file secondo percorso primo file strcpy(pad->achpath, pflist + 1); pcur = ioFNameFromPath(pad->achpath); *pcur = 0; } /* endif */ // processa lista stringhe --------------------------------------------- if (pbf->frl.citems) { PSZ pszitem = malloc(MAXSTRITEM); if (!pszitem) {pszerr = SZERR_ALLOC; goto end;} // secondo versione del file usa 2 diverse funzioni per ricavare if (pad->is.bever) { // la lista delle stringhe di find/replace if (!fillStrList(hlstr, pszitem, pbf)) {pszerr = SZERR_INVALIDFILE; goto end;} /* endif */ } else { if (!fillStrListOld(hlstr, pszitem, pbf)) {pszerr = SZERR_INVALIDFILE; goto end;} /* endif */ } /* endif */ free(pszitem); } /* endif */ } /* endif */ if ((cfiles && cstrings) || (pbf->offset && pbf->frl.citems)) { WsetDefBtn(pad->hMain, BTN_START); } else if (cfiles || pbf->offset) { WinPostMsg(pad->hMain, WM_DEFERFOCUS, (MPARAM)EF_FILE, MPVOID); } else { WinPostMsg(pad->hMain, WM_DEFERFOCUS, (MPARAM)EF_STRFIND, MPVOID); } /* endif */ rc = TRUE; end: if (pszerr) Wprint(pad->hMain, pszerr, 0); if (pbf) {free(pbf);} enableBtns(pad->hMain); WinEnableWindow(pad->hMain, TRUE); pad->is.working = 0; return TRUE; invalidFile: pszerr = SZERR_INVALIDFILE; goto end; }