mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-21 17:37:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,118 @@
|
||||
package com.sbi.popup
|
||||
{
|
||||
import flash.events.MouseEvent;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiRadioButtonGroup;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class SBPollPopupAdjustable extends SBPollPopup
|
||||
{
|
||||
|
||||
public static const POLL_POPUP_WOOD_MEDIA_ID:int = 3931;
|
||||
|
||||
private var _options:Array;
|
||||
|
||||
public function SBPollPopupAdjustable()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override protected function setUpPollPopup() : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
_pollPopup.bx.addEventListener("mouseDown",onCloseBtnDown,false,0,true);
|
||||
_pollPopup.addEventListener("mouseDown",onPopupDown,false,0,true);
|
||||
var _loc2_:String = _pollDef.poll;
|
||||
var _loc3_:int = _loc2_.indexOf("|");
|
||||
LocalizationManager.updateToFit(_pollPopup.bodyTxt,_loc2_.substring(0,_loc3_));
|
||||
var _loc1_:Array = _loc2_.substring(_loc3_ + 1,_loc2_.length).split("|");
|
||||
if(_randomizeOrder)
|
||||
{
|
||||
_loc1_ = Utility.shuffleArray(_loc1_,_randOptionLookup);
|
||||
}
|
||||
_numOptions = _loc1_.length;
|
||||
LocalizationManager.updateToFit(_pollPopup.titleTxt,_pollDef.title);
|
||||
_options = [];
|
||||
_loc4_ = 1;
|
||||
while(_loc4_ < 6)
|
||||
{
|
||||
if(_loc4_ < _numOptions + 1)
|
||||
{
|
||||
_pollPopup["answer" + _loc4_ + "Txt"].text = _loc1_[_loc4_ - 1];
|
||||
_pollPopup["option" + _loc4_].addEventListener("click",onOptionSelected,false,0,true);
|
||||
_options.push(_pollPopup["option" + _loc4_]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_pollPopup["answer" + _loc4_ + "Txt"].visible = false;
|
||||
_pollPopup["option" + _loc4_].visible = false;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
_optionsGroup = new GuiRadioButtonGroup(_options);
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
open(_pollPopup);
|
||||
}
|
||||
|
||||
override protected function onOptionSelected(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
processVote();
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(_optionsGroup)
|
||||
{
|
||||
_optionsGroup.destroy();
|
||||
_optionsGroup = null;
|
||||
}
|
||||
_loc1_ = 1;
|
||||
while(_loc1_ < _numOptions + 1)
|
||||
{
|
||||
_pollPopup["option" + _loc1_].removeEventListener("click",onOptionSelected);
|
||||
_loc1_++;
|
||||
}
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
private function processVote(param1:String = null) : void
|
||||
{
|
||||
if(_onVoteCallback != null)
|
||||
{
|
||||
_onVoteCallback(_tab,_randOptionLookup[_optionsGroup.selected] + 1,param1);
|
||||
}
|
||||
close(_pollPopup);
|
||||
_onDoneCallback();
|
||||
}
|
||||
|
||||
private function setupNameInput() : void
|
||||
{
|
||||
_pollPopup.submitBtn.addEventListener("mouseDown",onSubmitNameBtn,false,0,true);
|
||||
_pollPopup.name_txt.addEventListener("mouseDown",onNameText,false,0,true);
|
||||
_pollPopup.name_txt.alpha = 0.5;
|
||||
}
|
||||
|
||||
private function onSubmitNameBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_pollPopup.name_txt.alpha == 1 && _pollPopup.name_txt.length > 0)
|
||||
{
|
||||
processVote(_pollPopup.name_txt.text);
|
||||
}
|
||||
}
|
||||
|
||||
private function onNameText(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.alpha == 0.5)
|
||||
{
|
||||
param1.currentTarget.text = "";
|
||||
param1.currentTarget.alpha = 1;
|
||||
param1.currentTarget.removeEventListener("mouseDown",onNameText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user