public IGameAction CreateIdleAnimation(Entity entity, double lapse) { var actionAnimation = GameActionFactory.CreateLoopGameActionUntil(entity.Scene, () => new ScaleTo3DGameAction(entity, new Vector3(100f, 90f, 100f), TimeSpan.FromMilliseconds(lapse), EaseFunction.CubicInEase) .ContinueWith(new ScaleTo3DGameAction(entity, Vector3.One * 100, TimeSpan.FromMilliseconds(lapse), EaseFunction.CubicOutEase)), () => false); return(actionAnimation); }
/// <summary> /// Creates new structure according to def belonging to factory's faction /// </summary> /// <param name="def">Definition of structure to be created</param> /// <returns>Structure defined by Def belonging to factory's faction</returns> public IStructure <IStructureDef> CreateNewBuilding(IStructureDef def) { IStructure <IStructureDef> buildingController; switch (def) { case ResourceFactoryDef resourceFactoryDef: buildingController = new ResourceFactoryController(resourceFactoryDef, faction); break; case TrainingStructureDef trainingStructureDef: TrainingStructureController structureController = new TrainingStructureController(trainingStructureDef, game.Spawner); structureController.Faction = faction; GameActionFactory gameActionFactory = new GameActionFactory(game); foreach (ITrainableDef trainableDef in trainingStructureDef.TrainableDefs) { IGameAction gameAction = gameActionFactory.CreateTrainAction(trainableDef, structureController); structureController.GameActions.Add(gameAction); } buildingController = structureController; break; default: buildingController = new BuildingController((BuildingDef)def); buildingController.Faction = faction; break; } return(buildingController); }
private IGameAction CreateContextAnimation(bool appear, ScreenContext screenContext) { if (screenContext == null || screenContext.Count <= 0) { return(GameActionFactory.CreateEmptyGameAction(null)); } List <IGameAction> sceneAnimations = new List <IGameAction>(); for (int i = 0; i < screenContext.Count; i++) { var animatedNavigationScene = screenContext[i] as IAnimatedNavigationScene; if (animatedNavigationScene != null) { if (appear) { sceneAnimations.Add(animatedNavigationScene.CreateAppearGameAction()); } else { sceneAnimations.Add(animatedNavigationScene.CreateDiappearGameAction()); } } } return(GameActionFactory.CreateParallelGameActions(null as Scene, sceneAnimations) .WaitAll()); }
private void PreloadAndNavigateFoward(Scene nextScene, bool isModal = false, bool doTransition = true) { var transitionDuration = TimeSpan.FromSeconds(0.2f); ScreenTransition transition = null; ScreenContext nextConxtext; if (isModal) { nextConxtext = new ScreenContext(nextScene); } else { nextConxtext = new ScreenContext(this.backgroundMenu, nextScene); } var transitionAction = GameActionFactory.CreateGameActionFromAction(null, () => { var screenContextManager = WaveServices.ScreenContextManager; if (isModal) { screenContextManager.CurrentContext.Behavior = ScreenContextBehaviors.DrawInBackground; } transition = doTransition ? new CrossFadeTransition(transitionDuration) : null; screenContextManager.Push(nextConxtext, transition); }) .AndWaitCondition(() => !doTransition || transition.CurrentTime >= transitionDuration); this.PreloadAndNavigateFoward(nextConxtext, transitionAction); }
private IGameAction DeferedAction(AnimationJoint joint, float time, Vector3 to) { return(GameActionFactory.CreateGameAction(this, () => { // This will execute in the moment this animations is executed, and not when created return GameActionFactory.CreateGameAction(this, new Vector3AnimationGameAction(joint.Owner, joint.Transform.LocalRotation, to, TimeSpan.FromSeconds(time), EaseFunction.CubicInOutEase, (v) => { joint.Transform.LocalRotation = v; })); })); }
protected override void Start() { base.Start(); var robotSound = this.EntityManager.FindFirstComponentOfType <SoundEmitter3D>(); var joints = this.EntityManager.FindComponentsOfType <AnimationJoint>(); var hip = joints.FirstOrDefault(j => j.Joint == JointEnum.Hip); var box = joints.FirstOrDefault(j => j.Joint == JointEnum.Box); var elbow = joints.FirstOrDefault(j => j.Joint == JointEnum.Elbow); var handedBox = joints.FirstOrDefault(j => j.Joint == JointEnum.HandedBox); var shoulder = joints.FirstOrDefault(j => j.Joint == JointEnum.Shoulder); var wrist = joints.FirstOrDefault(j => j.Joint == JointEnum.Wrist); var pi2 = (float)Math.PI * 2f; box.Owner.IsVisible = false; var welcomeAnim = GameActionFactory.CreateGameAction(this, new Vector3AnimationGameAction(hip.Owner, Vector3.Zero, (pi2 * 0.5f) * Vector3.UnitY, TimeSpan.FromSeconds(2), EaseFunction.BackInEase, (v) => { hip.Transform.LocalRotation = v; })) .ContinueWith(new Vector3AnimationGameAction(wrist.Owner, Vector3.Zero, pi2 * Vector3.UnitY, TimeSpan.FromSeconds(2), EaseFunction.CubicInOutEase, (v) => { wrist.Transform.LocalRotation = v; })); var extendshoulder = GameActionFactory.CreateGameAction(this, new Vector3AnimationGameAction(shoulder.Owner, Vector3.Zero, this.ToRad(-54.53f, 0, -20f), TimeSpan.FromSeconds(2), EaseFunction.CubicInOutEase, (v) => { shoulder.Transform.LocalRotation = v; })); var extendwrist = GameActionFactory.CreateGameAction(this, new Vector3AnimationGameAction(wrist.Owner, Vector3.Zero, this.ToRad(18.8153f, 0, 0), TimeSpan.FromSeconds(2), EaseFunction.CubicInOutEase, (v) => { wrist.Transform.LocalRotation = v; })); var extendelbow = GameActionFactory.CreateGameAction(this, new Vector3AnimationGameAction(elbow.Owner, Vector3.Zero, this.ToRad(35.98f, 0, 0), TimeSpan.FromSeconds(2), EaseFunction.CubicInOutEase, (v) => { elbow.Transform.LocalRotation = v; })); GameActionFactory.CreateDelayGameAction(this, TimeSpan.FromSeconds(1)) .ContinueWith(welcomeAnim) .CreateParallelGameActions(new List <IGameAction>() { extendelbow, extendshoulder, extendwrist }) .WaitAll() .ContinueWithAction(() => { box.Owner.IsVisible = true; handedBox.Owner.IsVisible = false; box.Transform.Position = handedBox.Transform.Position; }) .CreateParallelGameActions(new List <IGameAction>() { this.DeferedAction(shoulder, 1, Vector3.Zero), this.DeferedAction(shoulder, 1, Vector3.Zero), this.DeferedAction(shoulder, 1, Vector3.Zero) }) .WaitAll() .ContinueWith(this.DeferedAction(hip, 2, Vector3.Zero)) .Run(); }
void Update() { eventType = NetworkTransport.Receive(out recHostId, out connectionId, out channelId, buffer, bufferSize, out dataSize, out error); if (error != (byte)NetworkError.Ok) { Debug.LogError("[ERROR] NetworkAPI :: Update :: Receive : " + error); if (dataSize > bufferSize) { Debug.LogError("[ERROR] NetworkAPI :: Update : Message too big for be handled by buffer..."); } return; } if (channelId == channelSetupId) { switch (eventType) { case NetworkEventType.ConnectEvent: NetworkUI.Log("Connection on socket " + recHostId + ", connection : " + connectionId + ", channelId : " + channelId); if (PlayerId == 0) { OnConnection(); } break; // case NetworkEventType.DataEvent: break; case NetworkEventType.DisconnectEvent: Application.Quit(); // TEST quit on disconnect break; } } else if (eventType == NetworkEventType.DataEvent) { if (channelId == channelActionId && OnAction != null) { OnAction(PlayerId == 0 ? 1 : 0, GameActionFactory.Get(buffer)); } else if (channelId == channelConfirmationId && OnConfirmation != null) { OnConfirmation(PlayerId == 0 ? 1 : 0, GameConfirmation.FromBytes(buffer)); } } }
void Start() { var gameObjectFactory = new GameObjectFactory(cardPrefabMap, playerPrefab); var deployer = new Deployer(gameObjectFactory, arena, gameplayHUD); var gameActionFactory = new GameActionFactory(deployer); gameplayHUD.Setup(gestureRecognizer, arena); gameplayHUD.CreateCardSlots(PlayerHand.HandSize); HomePlayer = gameObjectFactory.CreatePlayer(Team.Home); VisitorPlayer = gameObjectFactory.CreatePlayer(Team.Visitor); HomePlayer.Setup(PlayerDeck.GetDummyDeck()); VisitorPlayer.Setup(PlayerDeck.GetDummyDeck()); Dealer.DealInitialCards(HomePlayer); Dealer.DealInitialCards(VisitorPlayer); matchReferee.Setup(gameActionFactory, players: new [] { HomePlayer, VisitorPlayer }); }
private void NavigateBack(bool doTransition = true) { this.SetPerformingNavigationFlag(true); if (doTransition) { var transitionDuration = TimeSpan.FromSeconds(0.2f); var transition = new CrossFadeTransition(transitionDuration); WaveServices.ScreenContextManager.Pop(transition); GameActionFactory.CreateWaitConditionGameAction(null, () => transition.CurrentTime >= transitionDuration) .ContinueWithAction(() => { this.SetPerformingNavigationFlag(false); }) .Run(); } else { WaveServices.ScreenContextManager.Pop(); this.SetPerformingNavigationFlag(false); } }
public void OnPlayerUsedCard(CardType card, Team team, int laneIdx) { var deployCardAction = GameActionFactory.CreateDeployCardAction(card, team, laneIdx); ActionsQueue.ScheduleAction(deployCardAction); }
public void Setup(GameActionFactory gameActionFactory, IEnumerable <IPlayer> players) { GameActionFactory = gameActionFactory; Players = players.ToList(); }
public override void InitialiseOptions() { var gameManager = OpenTibiaUnity.GameManager; var optionStorage = OpenTibiaUnity.OptionStorage; var player = OpenTibiaUnity.Player; bool isClassic = optionStorage.MousePreset == MousePresets.Classic; bool isRegular = optionStorage.MousePreset == MousePresets.Regular; bool isLeftSmartClick = optionStorage.MousePreset == MousePresets.LeftSmartClick; if (!!_lookObject) { CreateTextItem(TextResources.CTX_OBJECT_LOOK, "Shift", () => { if (!!_lookObject) { new LookActionImpl(_absolute, _lookObject, _lookObjectStackPos).Perform(); } }); } // Tibia 11 (CTX_OBJECT_INSPECT_OBJECT) if (!!_useObject && (_useObject.Type.IsContainer || _useObject.Type.DefaultAction == Protobuf.Shared.PlayerAction.Open)) { if (_absolute.x == 65535 && _absolute.y >= 64) { CreateTextItem(TextResources.CTX_OBJECT_OPEN, () => { if (!!_useObject) { GameActionFactory.CreateUseAction(_absolute, _useObject, _useObjectStackPos, Vector3Int.zero, null, 0, UseActionTarget.Auto).Perform(); } }); CreateTextItem(TextResources.CTX_OBJECT_OPEN_NEW_WINDOW, () => { if (!!_useObject) { GameActionFactory.CreateUseAction(_absolute, _useObject, _useObjectStackPos, Vector3Int.zero, null, 0, UseActionTarget.NewWindow).Perform(); } }); } else { CreateTextItem(TextResources.CTX_OBJECT_OPEN, () => { if (!!_useObject) { GameActionFactory.CreateUseAction(_absolute, _useObject, _useObjectStackPos, Vector3Int.zero, null, 0, UseActionTarget.NewWindow).Perform(); } }); } } if (!!_useObject && !_useObject.Type.IsContainer) { string text, shortcut; if (_useObject.Type.IsMultiUse) { text = TextResources.CTX_OBJECT_MULTIUSE; shortcut = isClassic ? "Alt" : (isRegular ? "Ctrl" : null); } else { text = TextResources.CTX_OBJECT_USE; shortcut = isRegular ? "Ctrl" : null; } CreateTextItem(text, shortcut, () => { //if (!!_useObject) // GameActionFactory.CreateUseAction(_absolute, _useObject, _useObjectStackPos, UseActionTarget.Auto).Perform(); }); } if (!!_useObject && _useObject.Type.IsWrappable) { CreateTextItem(TextResources.CTX_OBJECT_WRAP, () => { if (!!_useObject) { new ToggleWrapStateActionImpl(_absolute, _useObject, _useObjectStackPos).Perform(); } }); } if (!!_useObject && _useObject.Type.IsUnwrappable) { CreateTextItem(TextResources.CTX_OBJECT_UNWRAP, () => { if (!!_useObject) { new ToggleWrapStateActionImpl(_absolute, _useObject, _useObjectStackPos).Perform(); } }); } if (!!_useObject && _useObject.Type.IsRotateable) { CreateTextItem(TextResources.CTX_OBJECT_TURN, () => { if (!!_useObject) { new TurnActionImpl(_absolute, _useObject, _useObjectStackPos).Perform(); } }); } if (gameManager.ClientVersion >= 984 && _absolute.x != 65535) { var worldMapStorage = OpenTibiaUnity.WorldMapStorage; var mapPosition = worldMapStorage.ToMap(_absolute); var @object = worldMapStorage.GetObject(mapPosition, 0); if (!!@object && @object.Type.IsGround) { CreateTextItem(TextResources.CTX_OBJECT_BROWSE_FIELD, () => new BrowseFieldActionImpl(_absolute).Perform()); } } CreateSeparatorItem(); if (_absolute.x != 65535 && OpenTibiaUnity.GameManager.ProtocolGame.BugReportsAllowed) { CreateTextItem(TextResources.CTX_OBJECT_REPORT_FIELD, () => { // TODO: Report Coordinate }); CreateSeparatorItem(); } if (!!_lookObject && _absolute.x == 65535 && _absolute.y >= 64 && OpenTibiaUnity.ContainerStorage.GetContainerView(_absolute.y - 64).IsSubContainer) { CreateTextItem(TextResources.CTX_OBJECT_MOVE_UP, () => { if (!!_lookObject) { GameActionFactory.CreateMoveAction(_absolute, _lookObject, _lookObjectStackPos, new Vector3Int(_absolute.x, _absolute.y, 254), MoveActionImpl.MoveAll).Perform(); } }); } if (!!_lookObject && !_lookObject.IsCreature && !_lookObject.Type.IsUnmovable && _lookObject.Type.IsPickupable) { CreateTextItem(TextResources.CTX_OBJECT_TRADE, () => { // TODO //if (!!_lookObject) // new SafeTradeActionImpl(_absolute, _lookObject, _lookObjectStackPos).Perform(); }); } if (!!_lookObject && !_lookObject.IsCreature && _lookObject.Type.IsMarket && player.IsInDepot) { CreateTextItem(TextResources.CTX_OBJECT_SHOW_IN_MARKET, () => { // TODO, show in market }); } if (gameManager.GetFeature(GameFeature.GameQuickLoot) && !!_lookObject && !_lookObject.IsCreature && !_lookObject.Type.IsUnmovable && _lookObject.Type.IsPickupable) { CreateSeparatorItem(); if (_lookObject.Type.IsContainer && _absolute.x == 65535) { CreateTextItem(TextResources.CTX_OBJECT_MANAGE_LOOT_CONTAINERS, () => { // TODO, manage loot containers }); } else { CreateTextItem(TextResources.CTX_OBJECT_QUICK_LOOT, () => { // TODO, quick loot }); } } if (gameManager.GetFeature(GameFeature.GameStash) && !!_lookObject && !_lookObject.IsCreature && !_lookObject.Type.IsUnmovable && _lookObject.Type.IsPickupable && (_lookObject.Type.IsStackable || _lookObject.Type.IsContainer)) { CreateSeparatorItem(); if (_lookObject.Type.IsStackable) { CreateTextItem(TextResources.CTX_OBJECT_STOW, () => { // TODO, stow }); CreateTextItem(TextResources.CTX_OBJECT_STOW_ALL, () => { // TODO, stow all }); } else { CreateTextItem(TextResources.CTX_OBJECT_STOW_CONTENT, () => { // TODO, stow all }); } } var creatureStorage = OpenTibiaUnity.CreatureStorage; if (!!_creature && _creature.Id != player.Id) { if (_creature.IsNPC) { CreateTextItem(TextResources.CTX_CREATURE_TALK, () => { GameActionFactory.CreateGreetAction(_creature).Perform(); }); } else { var attackTarget = creatureStorage.AttackTarget; var text = (!attackTarget || attackTarget.Id != _creature.Id) ? TextResources.CTX_CREATURE_ATTACK_START : TextResources.CTX_CREATURE_ATTACK_STOP; var shortcut = (isClassic || isRegular) ? "Alt" : null; CreateTextItem(text, shortcut, () => { GameActionFactory.CreateToggleAttackTargetAction(_creature, true).Perform(); }); } var followTarget = creatureStorage.FollowTarget; CreateTextItem((!followTarget || followTarget.Id != _creature.Id) ? TextResources.CTX_CREATURE_FOLLOW_START : TextResources.CTX_CREATURE_FOLLOW_STOP, () => { creatureStorage.ToggleFollowTarget(_creature, true); }); if (_creature.IsConfirmedPartyMember) { CreateTextItem(string.Format(TextResources.CTX_PARTY_JOIN_AGGRESSION, _creature.Name), () => { new PartyActionImpl(PartyActionType.JoinAggression, _creature).Perform(); }); } if (_creature.IsHuman) { CreateTextItem(string.Format(TextResources.CTX_PLAYER_CHAT_MESSAGE, _creature.Name), () => { new PrivateChatActionImpl(PrivateChatActionType.OpenMessageChannel, PrivateChatActionImpl.ChatChannelNoChannel, _creature.Name).Perform(); }); var chatStorage = OpenTibiaUnity.ChatStorage; if (chatStorage.HasOwnPrivateChannel) { CreateTextItem(TextResources.CTX_PLAYER_CHAT_INVITE, () => { new PrivateChatActionImpl(PrivateChatActionType.ChatChannelInvite, chatStorage.OwnPrivateChannelId, _creature.Name).Perform(); }); } //if (!BuddylistActionImpl.IsBuddy(this._creature._id)) { // CreateTextItem(TextResources.CTX_PLAYER_ADD_BUDDY, () => { // if (!!_creature) // new BuddylistActionImpl(BuddylistActionImpl.ADD_BY_NAME, _creature.name).Perform(); // }); //} //if (NameFilterActionImpl.s_IsBlacklisted(this._creatureTarget.name)) { // CreateTextItem(string.Format(TextResources.CTX_PLAYER_UNIGNORE, _creature.Name), () => { // if (!!_creature) // new NameFilterActionImpl(NameFilterActionImpl.UNIGNORE, _creature.Name).Perform(); // }); //} else { // CreateTextItem(string.Format(TextResources.CTX_PLAYER_IGNORE, _creature.Name), () => { // if (!!_creature) // new NameFilterActionImpl(NameFilterActionImpl.IGNORE, _creatureTarget.name).Perform(); // }); //} switch (player.PartyFlag) { case PartyFlag.Leader: CreateTextItem(TextResources.CTX_PARTY_EXCLUDE, () => new PartyActionImpl(PartyActionType.Exclude, _creature).Perform()); break; case PartyFlag.Leader_SharedXP_Active: case PartyFlag.Leader_SharedXP_Inactive_Guilty: case PartyFlag.Leader_SharedXP_Inactive_Innocent: case PartyFlag.Leader_SharedXP_Off: switch (_creature.PartyFlag) { case PartyFlag.Member: CreateTextItem(string.Format(TextResources.CTX_PARTY_EXCLUDE, _creature.Name), () => new PartyActionImpl(PartyActionType.Exclude, _creature).Perform()); break; case PartyFlag.Member_SharedXP_Active: case PartyFlag.Member_SharedXP_Inactive_Guilty: case PartyFlag.Member_SharedXP_Inactive_Innocent: case PartyFlag.Member_SharedXP_Off: CreateTextItem(string.Format(TextResources.CTX_PARTY_PASS_LEADERSHIP, _creature.Name), () => new PartyActionImpl(PartyActionType.PassLeadership, _creature).Perform()); break; default: CreateTextItem(string.Format(TextResources.CTX_PARTY_INVITE, _creature.Name), () => new PartyActionImpl(PartyActionType.Invite, _creature).Perform()); break; } break; case PartyFlag.Member_SharedXP_Active: case PartyFlag.Member_SharedXP_Inactive_Guilty: case PartyFlag.Member_SharedXP_Inactive_Innocent: case PartyFlag.Member_SharedXP_Off: break; case PartyFlag.None: case PartyFlag.Member: if (_creature.PartyFlag == PartyFlag.Leader) { CreateTextItem(string.Format(TextResources.CTX_PARTY_JOIN, _creature.Name), () => new PartyActionImpl(PartyActionType.Join, _creature).Perform()); } else if (_creature.PartyFlag != PartyFlag.Other) { CreateTextItem(string.Format(TextResources.CTX_PARTY_INVITE, _creature.Name), () => new PartyActionImpl(PartyActionType.Invite, _creature).Perform()); } break; } // Tibia 11 (CTX_INSPECT_CHARACTER) } CreateSeparatorItem(); if (_creature.IsReportTypeAllowed(ReportTypes.Name)) { CreateTextItem(TextResources.CTX_PLAYER_REPORT_NAME, () => { // TODO //if (!!_creature) // new ReportWidget(ReportTypes.Name, _creature).show(); }); } if (_creature.IsReportTypeAllowed(ReportTypes.Bot)) { CreateTextItem(TextResources.CTX_PLAYER_REPORT_BOT, () => { // TODO //if (!!_creature) // new ReportWidget(ReportTypes.Bot, _creature).show(); }); } } CreateSeparatorItem(); if (!!_creature && _creature.Id == player.Id) { CreateTextItem(TextResources.CTX_PLAYER_SET_OUTFIT, () => StaticActionList.MiscShowOutfit.Perform()); CreateTextItem(!!player.MountOutfit ? TextResources.CTX_PLAYER_DISMOUNT : TextResources.CTX_PLAYER_MOUNT, () => StaticActionList.PlayerMount.Perform()); //CreateTextItem(TextResources.CTX_PLAYER_OPEN_PREY_DIALOG, () => StaticActionList.MiscShowPreyDialog.Perform()); if (player.IsPartyLeader && !player.IsFighting) { if (player.IsPartySharedExperienceActive) { CreateTextItem(string.Format(TextResources.CTX_PARTY_DISABLE_SHARED_EXPERIENCE, _creature.Name), () => new PartyActionImpl(PartyActionType.DisableSharedExperience, _creature).Perform()); } else { CreateTextItem(string.Format(TextResources.CTX_PARTY_ENABLE_SHARED_EXPERIENCE, _creature.Name), () => new PartyActionImpl(PartyActionType.EnableSharedExperience, _creature).Perform()); } } if (player.IsPartyMember && !player.IsFighting) { CreateTextItem(TextResources.CTX_PARTY_LEAVE, () => new PartyActionImpl(PartyActionType.Leave, _creature).Perform()); } // Tibia 11 (CTX_INSPECT_CHARACTER) } CreateSeparatorItem(); if (!!_creature) { CreateTextItem(TextResources.CTX_CREATURE_COPY_NAME, () => { if (!!_creature) { GUIUtility.systemCopyBuffer = _creature.Name; } }); } }
protected AppearanceActions DetermineAction(Vector3 mousePosition, MouseButton mouseButton, EventModifiers eventModifiers, ObjectInstance @object, bool applyAction = false, bool updateCursor = false) { if (!@object) { return(AppearanceActions.None); } if (updateCursor) { updateCursor = OpenTibiaUnity.GameManager.ClientVersion >= 1100; } var inputHandler = OpenTibiaUnity.InputHandler; if (inputHandler.IsMouseButtonDragged(MouseButton.Left) || inputHandler.IsMouseButtonDragged(MouseButton.Right)) { return(AppearanceActions.None); } var action = AppearanceActions.None; var optionStorage = OpenTibiaUnity.OptionStorage; if (optionStorage.MousePreset == MousePresets.LeftSmartClick) { if (eventModifiers == EventModifiers.None || eventModifiers == EventModifiers.Control) { if (mouseButton == MouseButton.Left || mouseButton == MouseButton.None) { action = AppearanceActions.Open; var defaultAction = @object.Type.DefaultAction; if (defaultAction == Protobuf.Shared.PlayerAction.Open) { action = AppearanceActions.Open; } else if (defaultAction == Protobuf.Shared.PlayerAction.Look) { action = AppearanceActions.Look; } else if (defaultAction == Protobuf.Shared.PlayerAction.Use) { action = AppearanceActions.Use; } else if (@object.Type.IsContainer) { action = AppearanceActions.Open; } else if (@object.Type.IsForceUse || @object.Type.IsMultiUse || @object.Type.IsUsable) { action = AppearanceActions.Use; } else { action = AppearanceActions.Look; } } else if (mouseButton == MouseButton.Right && eventModifiers == EventModifiers.None) { action = AppearanceActions.ContextMenu; } } else if (eventModifiers == EventModifiers.Shift) { if (mouseButton == MouseButton.Left || mouseButton == MouseButton.None) { action = AppearanceActions.Look; } } } else if (optionStorage.MousePreset == MousePresets.Classic) { if (mouseButton == MouseButton.Left || mouseButton == MouseButton.None) { if (eventModifiers == EventModifiers.Shift) { action = AppearanceActions.Look; } else if (eventModifiers == EventModifiers.Control) { action = AppearanceActions.ContextMenu; } else if (eventModifiers == EventModifiers.Alt) { action = AppearanceActions.Open; } } else if (mouseButton == MouseButton.Right) { if (eventModifiers == EventModifiers.None) { action = AppearanceActions.Open; } else if (eventModifiers == EventModifiers.Control) { action = AppearanceActions.ContextMenu; } } else if (mouseButton == MouseButton.Both) { action = AppearanceActions.Look; } } else if (optionStorage.MousePreset == MousePresets.Regular) { if (mouseButton == MouseButton.Left || mouseButton == MouseButton.None) { if (eventModifiers == EventModifiers.Shift) { action = AppearanceActions.Look; } else if (eventModifiers == EventModifiers.Control) { action = AppearanceActions.Open; } else if ((eventModifiers & EventModifiers.Alt) != 0 && (eventModifiers & EventModifiers.Shift) == 0) { action = AppearanceActions.ContextMenu; } } else if (mouseButton == MouseButton.Right) { if (eventModifiers == EventModifiers.None) { action = AppearanceActions.ContextMenu; } else if (eventModifiers == EventModifiers.Control) { action = AppearanceActions.Open; } } } if (updateCursor) { OpenTibiaUnity.GameManager.CursorController.SetCursorState(action, CursorPriority.Medium); } if (applyAction) { var absolutePosition = new Vector3Int(65535, 64 + m_ContainerView.ID, m_SlotUnderMouse); switch (action) { case AppearanceActions.None: break; case AppearanceActions.ContextMenu: OpenTibiaUnity.CreateObjectContextMenu(absolutePosition, @object, absolutePosition.z, @object, absolutePosition.z, null) .Display(mousePosition); break; case AppearanceActions.Look: new LookActionImpl(absolutePosition, @object.Type, absolutePosition.z).Perform(); break; case AppearanceActions.Use: if (@object.Type.IsMultiUse) { ObjectMultiUseHandler.Activate(absolutePosition, @object, absolutePosition.z); } else { GameActionFactory.CreateUseAction(absolutePosition, @object.Type, absolutePosition.z, Vector3Int.zero, null, 0, UseActionTarget.Auto).Perform(); } break; case AppearanceActions.Open: GameActionFactory.CreateUseAction(absolutePosition, @object.Type, absolutePosition.z, Vector3Int.zero, null, 0, UseActionTarget.Auto).Perform(); break; case AppearanceActions.Unset: break; } } return(action); }