Brought up to date with the private repository (feea4c7)

This commit is contained in:
S committed 2026-10-14 20:57:33 +03:00
1 parent 1aa738d692
commit 1b1df1ae48
7925 files changed
+2617237 -20

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -0,0 +1,237 @@
package game.trueFalse
{
import avatar.Avatar;
import avatar.AvatarUtility;
import avatar.AvatarView;
import avatar.AvatarViewExt_Splash;
import avatar.NameBar;
import avatar.UserInfo;
import buddy.BuddyManager;
import com.sbi.graphics.LayerBitmap;
import flash.display.Sprite;
import flash.events.MouseEvent;
import game.MinigameManager;
import gui.ChatBalloon;
import localization.LocalizationManager;
import room.RoomManagerWorld;
public class TrueFalseAvatarView extends AvatarView
{
private static const NAMEBAR_X_OFFSET:int = -15;
private static const NAMEBAR_Y_OFFSET:int = 18;
private var _chatBalloon:ChatBalloon;
public var _chatLayer:Sprite;
private var _splash:AvatarViewExt_Splash;
private var _namebar:NameBar;
private var _isMember:Boolean;
private var _guiObj:Object;
private var _isGuide:Boolean;
public function TrueFalseAvatarView()
{
super();
}
override public function init(param1:Avatar, param2:Function = null, param3:Function = null, param4:Boolean = false, param5:Boolean = false) : void
{
super.init(param1,param2);
_chatBalloon = GETDEFINITIONBYNAME("ChatBalloonAsset");
_chatBalloon.init(_avatar.avTypeId,AvatarUtility.getAvatarEmoteBgOffset,false,1,RoomManagerWorld.instance.layerManager.bkg.scaleX);
_chatLayer.addChild(_chatBalloon);
var _loc6_:LayerBitmap = _layerAnim.bitmap;
_loc6_.x = 0;
_loc6_.y = 0;
_splash = new AvatarViewExt_Splash(this,_loc6_);
BuddyManager.eventDispatcher.addEventListener("OnBuddyChanged",toggleNamebarSelNub,false,0,true);
}
public function setupNamebar(param1:Boolean = true) : void
{
var _loc2_:UserInfo = gMainFrame.userInfo.getUserInfoByUserName(userName);
var _loc3_:int = _loc2_.nameBarData;
initNamebar(_loc2_.accountType);
_guiObj = {"showUserInfoPopup":BuddyManager.showBuddyCard};
setNamebarListenersWithUserName(userName);
toggleNamebarSelNub(_loc3_);
_namebar.setColorAndBadge(_loc3_);
_namebar.mouseChildren = false;
if(isSelf)
{
_namebar.mouseEnabled = false;
_chatBalloon.mouseChildren = false;
_chatBalloon.mouseEnabled = false;
}
_namebar.setAvName(gMainFrame.userInfo.getAvatarInfoByUserName(_loc2_.userName).avName);
}
public function heartbeat(param1:Number) : void
{
if(!_chatBalloon)
{
return;
}
_chatBalloon.heartbeat(param1 * 1000);
if(parent)
{
_chatBalloon.x = x + parent.x;
_chatBalloon.y = y - 100 + parent.y;
}
}
public function addAvatarMessage(param1:String, param2:int) : void
{
var _loc3_:Boolean = false;
if(param2 > 1)
{
if(param2 == 2)
{
param1 = LocalizationManager.translateIdOnly(int(param1.split("|")[0]));
}
_loc3_ = true;
}
_chatBalloon.setText(param1,_loc3_);
}
public function setEmote(param1:Sprite) : void
{
if(param1)
{
_chatBalloon.setEmote(param1);
}
else
{
_chatBalloon.setReadyForClear();
}
}
override public function destroy(param1:Boolean = false) : void
{
super.destroy(param1);
if(_splash)
{
_splash.destroy();
}
if(_chatBalloon && _chatBalloon.parent == _chatLayer)
{
_chatLayer.removeChild(_chatBalloon);
}
removeEventListener("mouseDown",namebarAndAvatarDownHandler);
_namebar.removeEventListener("mouseDown",namebarAndAvatarDownHandler);
_namebar["selnub"].removeEventListener("mouseDown",namebarAndAvatarDownHandler);
_chatBalloon = null;
if(_namebar)
{
_namebar.destroy();
}
_namebar = null;
}
private function initNamebar(param1:int) : void
{
_isMember = MinigameManager.isMember(param1);
if(_isMember || Boolean(gMainFrame.userInfo.getUserInfoByUserName(userName).isGuide))
{
_namebar = GETDEFINITIONBYNAME("memberNameBar");
}
else
{
_namebar = GETDEFINITIONBYNAME("FreeNameBar");
}
_namebar.x = -15;
_namebar.y = 18;
addChild(_namebar);
}
private function setNamebarListenersWithUserName(param1:String) : void
{
if(!param1)
{
return;
}
if(param1 != gMainFrame.server.userName || Boolean(gMainFrame.userInfo.isModerator))
{
_namebar.addEventListener("mouseDown",namebarAndAvatarDownHandler,false,0,true);
_namebar["selnub"].addEventListener("mouseDown",namebarAndAvatarDownHandler,false,0,true);
}
else
{
_namebar.removeListeners();
}
}
private function namebarAndAvatarDownHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
var _loc2_:Object = {
"userName":userName,
"onlineStatus":1
};
if(_guiObj)
{
_guiObj.showUserInfoPopup(_loc2_);
}
}
public function toggleNamebarSelNub(param1:int = -1) : void
{
var _loc2_:int = 0;
if(!_namebar)
{
return;
}
if(_isGuide)
{
_namebar.setNubType(NameBar.GUIDE);
}
else
{
if(param1 == -1)
{
_loc2_ = _namebar.packedNameBarData;
}
else
{
_loc2_ = param1;
}
if(BuddyManager.isBuddy(_avatar.userName) || isSelf || _isMember && NameBar.isVIPBadge(_loc2_))
{
_namebar.setNubType(NameBar.BUDDY);
}
else
{
_namebar.setNubType(NameBar.NON_BUDDY);
}
}
if(!isSelf)
{
if(BuddyManager.isBlocked(_avatar.userName))
{
_namebar.isBlocked = true;
}
else
{
_namebar.isBlocked = false;
}
}
else
{
_namebar.isBlocked = false;
}
}
private function get isSelf() : Boolean
{
return userName == gMainFrame.userInfo.myUserName;
}
}
}
@@ -0,0 +1,456 @@
package game.trueFalse
{
import avatar.AvatarXtCommManager;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.geom.Point;
public class TrueFalsePlayer
{
public var pId:int;
public var sfsId:int;
public var dbId:int;
public var userName:String;
public var _avtView:TrueFalseAvatarView;
public var _bCorrect:Boolean;
public var _avatarDirection:Point;
private var _dir:Point;
private var _followPath:Vector.<int>;
private var _movePlayerToPos:Point;
private var _moving:int;
public var _moveToX:int;
public var _moveToY:int;
private var _lastMoveAngle:Number;
private var _lastIdleAnim:int;
private var _lastIdleFlip:Boolean;
public var _localPlayer:Boolean;
private var _theGame:TrueFalse;
private var _throttle:Number;
private var _serverX:int;
private var _serverY:int;
public var _splash:MovieClip;
public var _isDancing:Boolean;
public var _gemBonus:MovieClip;
public function TrueFalsePlayer(param1:TrueFalse)
{
super();
_theGame = param1;
_avatarDirection = new Point();
_dir = new Point();
_throttle = 0;
}
public static function convertToIdle(param1:Number) : Object
{
var _loc2_:int = 14;
var _loc4_:Boolean = false;
var _loc3_:Number = 1.5707963267948966;
if(param1 > -2 * _loc3_ && param1 < -_loc3_)
{
_loc2_ = 16;
_loc4_ = true;
}
else if(param1 >= -_loc3_ && param1 < 0)
{
_loc2_ = 16;
}
else if(param1 >= 0 && param1 < _loc3_)
{
_loc2_ = 14;
}
else
{
_loc2_ = 14;
_loc4_ = true;
}
return {
"anim":_loc2_,
"flip":_loc4_
};
}
public function destroy() : void
{
if(_avtView)
{
_avtView.destroy();
_avtView = null;
}
_avatarDirection = null;
}
public function addSplash() : void
{
_splash = GETDEFINITIONBYNAME("trueFalse_splashEffect");
_splash.x = -80;
_splash.y = -30;
if(_avtView.x < 450)
{
_splash.visible = false;
}
else
{
_splash.setState(2);
}
}
public function heartbeat(param1:Number) : void
{
var _loc3_:Number = _avtView.x;
var _loc5_:Number = _avtView.y;
var _loc4_:Number = _dir.x * 24 * param1 / 0.07;
var _loc2_:Number = _dir.y * 24 * param1 / 0.07;
_avtView.heartbeat(param1);
_throttle -= param1;
if(_localPlayer && _throttle <= 0 && (_serverX != _moveToX || _serverY != _moveToY))
{
_theGame.updatePosition(_moveToX,_moveToY);
_throttle = 0.5;
_serverX = _moveToX;
_serverY = _moveToY;
}
if(_loc4_)
{
if(_loc4_ > 0 && _loc4_ + _avtView.x >= _moveToX || _loc4_ < 0 && _loc4_ + _avtView.x <= _moveToX)
{
_dir.x = 0;
_loc3_ = _moveToX;
}
else
{
_loc3_ += _loc4_;
}
}
if(_loc2_)
{
if(_loc2_ > 0 && _loc2_ + _avtView.y >= _moveToY || _loc2_ < 0 && _loc2_ + _avtView.y <= _moveToY)
{
_dir.y = 0;
_loc5_ = _moveToY;
}
else
{
_loc5_ += _loc2_;
}
}
if(_loc3_ != _avtView.x || _loc5_ != _avtView.y)
{
_splash.setState(1);
if(_avtView.x >= 450 && _loc3_ < 450)
{
if(_localPlayer)
{
_theGame._bg.clearGuess();
_theGame._bg.guessTrue();
_theGame._soundMan.playByName(_theGame._soundNameCheck);
}
_splash.visible = false;
}
else if(_avtView.x < 450 && _loc3_ >= 450)
{
if(_localPlayer)
{
_theGame._bg.clearGuess();
_theGame._bg.guessFalse();
_theGame._soundMan.playByName(_theGame._soundNameX);
}
_splash.visible = true;
}
_avtView.x = _loc3_;
_avtView.y = _loc5_;
if(_localPlayer)
{
if(_avtView.x < 180)
{
_theGame._background.x = _theGame._playerLayer.x = Math.min(80,180 - _avtView.x);
}
else if(_avtView.x > 720)
{
_theGame._background.x = _theGame._playerLayer.x = Math.max(-80,720 - _avtView.x);
}
else
{
_theGame._background.x = 0;
}
if(_avtView.y > 450)
{
_theGame._background.y = _theGame._playerLayer.y = Math.max(-30,450 - _avtView.y);
}
else
{
_theGame._background.y = 0;
}
}
}
if(!_dir.x && !_dir.y)
{
switch(_moving - -1)
{
case 0:
playIdle();
break;
case 2:
if(!_followPath)
{
_moving = -1;
}
}
}
}
public function onAgResponse(param1:String, param2:Boolean, param3:int) : void
{
AvatarXtCommManager.requestADForAvatar(dbId,true,_avtView.setupNamebar,_avtView.avatarData);
}
public function setGuess(param1:Boolean = true) : void
{
if(_avtView.x < 450)
{
_theGame._bg.clearGuess();
_theGame._bg.guessTrue();
if(param1)
{
_theGame._soundMan.playByName(_theGame._soundNameCheck);
}
}
else
{
_theGame._bg.clearGuess();
_theGame._bg.guessFalse();
if(param1)
{
_theGame._soundMan.playByName(_theGame._soundNameX);
}
}
}
public function playIdle() : void
{
if(!_isDancing)
{
_avtView.playAnim(_lastIdleAnim,_lastIdleFlip);
}
_moving = 0;
_movePlayerToPos = null;
_dir.x = _dir.y = 0;
_splash.setState(2);
}
public function followCursorTest(param1:Number, param2:Boolean) : void
{
var _loc3_:Point = null;
var _loc6_:int = 0;
var _loc4_:Number = NaN;
var _loc5_:Number = NaN;
if(!_avtView.visible)
{
return;
}
if(param2)
{
setMoveTo(gMainFrame.mouseX - _theGame._background.x,gMainFrame.mouseY - _theGame._background.y);
if(Math.abs(_moveToX - _avtView.x) > 10 || Math.abs(_moveToY - _avtView.y) > 10)
{
updateAvatar(_moveToX,_moveToY);
if(_movePlayerToPos == null)
{
_movePlayerToPos = new Point();
}
_movePlayerToPos.x = _moveToX;
_movePlayerToPos.y = _moveToY;
}
_isDancing = false;
}
else if(_movePlayerToPos == null)
{
if(_avatarDirection.x != 0 || _avatarDirection.y != 0)
{
_loc3_ = new Point();
_loc6_ = 24 * param1 / 0.07;
_loc4_ = _avatarDirection.x * _loc6_;
_loc5_ = _avatarDirection.y * _loc6_;
_loc3_.x = _avtView.x;
_loc3_.y = _avtView.y;
updateAvatar(_loc3_.x + _loc4_,_loc3_.y + _loc5_);
_isDancing = false;
}
}
}
public function setAvatarDestination(param1:int, param2:int) : void
{
setMoveTo(param1,param2);
updateAvatar(_moveToX,_moveToY);
if(_movePlayerToPos == null)
{
_movePlayerToPos = new Point();
}
_movePlayerToPos.x = _moveToX;
_movePlayerToPos.y = _moveToY;
}
private function updateAvatar(param1:int, param2:int) : void
{
setPos(param1,param2);
}
private function setPos(param1:Number, param2:Number) : void
{
setMoveTo(param1,param2);
_dir.x = param1 - _avtView.x;
_dir.y = param2 - _avtView.y;
_dir.normalize(1);
faceAnim(_dir.x,_dir.y,true);
_moving = 1;
}
private function setMoveTo(param1:Number, param2:Number) : void
{
_moveToX = param1;
_moveToY = param2;
if(_moveToX > 940)
{
_moveToX = 940;
}
if(_moveToX < 0)
{
_moveToX = 0;
}
if(_moveToY > 580)
{
_moveToY = 580;
}
if(_moveToY < 10)
{
_moveToY = 10;
}
if(_localPlayer && _theGame._gameState == 4)
{
if(_avtView.x < 450)
{
if(_moveToX >= 450)
{
_moveToX = 449;
}
}
else if(_moveToX < 450)
{
_moveToX = 450;
}
}
}
private function faceAnim(param1:Number, param2:Number, param3:Boolean = true) : void
{
var _loc7_:Number = Math.atan2(param2,param1);
var _loc5_:Number = 0.3141592653589793;
var _loc10_:Number = 0.6283185307179586;
_lastMoveAngle = _loc7_;
var _loc8_:Object = convertToIdle(_lastMoveAngle);
_lastIdleAnim = _loc8_.anim;
_lastIdleFlip = _loc8_.flip;
var _loc6_:int = 0;
var _loc4_:Boolean = false;
if(_loc7_ >= 5 * _loc10_ - _loc5_ || _loc7_ < -5 * _loc10_ + _loc5_)
{
_loc6_ = 2;
_loc4_ = true;
}
else if(_loc7_ >= -4 * _loc10_ - _loc5_ && _loc7_ < -4 * _loc10_ + _loc5_)
{
_loc6_ = 1;
_loc4_ = true;
}
else if(_loc7_ >= -3 * _loc10_ - _loc5_ && _loc7_ < -3 * _loc10_ + _loc5_)
{
_loc6_ = 0;
_loc4_ = true;
}
else if(_loc7_ >= -2 * _loc10_ - _loc5_ && _loc7_ < -2 * _loc10_ + _loc5_)
{
_loc6_ = 0;
}
else if(_loc7_ >= -_loc10_ - _loc5_ && _loc7_ < -_loc10_ + _loc5_)
{
_loc6_ = 1;
}
else if(_loc7_ >= -_loc5_ && _loc7_ < _loc5_)
{
_loc6_ = 2;
}
else if(_loc7_ >= _loc10_ - _loc5_ && _loc7_ < _loc10_ + _loc5_)
{
_loc6_ = 3;
}
else if(_loc7_ >= 2 * _loc10_ - _loc5_ && _loc7_ < 2 * _loc10_ + _loc5_)
{
_loc6_ = 4;
}
else if(_loc7_ >= 3 * _loc10_ - _loc5_ && _loc7_ < 3 * _loc10_ + _loc5_)
{
_loc6_ = 4;
_loc4_ = true;
}
else
{
_loc6_ = 3;
_loc4_ = true;
}
var _loc9_:int = 7 + _loc6_;
if(!param3)
{
switch(_loc6_)
{
case 0:
case 1:
_loc9_ = 16;
break;
case 2:
case 3:
case 4:
_loc9_ = 14;
}
}
_avtView.playAnim(_loc9_,_loc4_,2);
}
public function playAnim(param1:Object) : void
{
_lastIdleAnim = param1.land;
_lastIdleFlip = param1.flip;
_avtView.playAnim(_lastIdleAnim,_lastIdleFlip);
}
public function setEmote(param1:Sprite) : void
{
_avtView.setEmote(param1);
}
}
}