Exemplo n.º 1
0
 public override void Interact()
 {
     if (breakFunctionality.isBroken)
     {
         var result = TrySetCurrentAction("Repair");
         if (result)
         {
             BeginUsing();
         }
         else
         {
             result.PrintErrorMessage();
         }
     }
     else
     {
         var result = TrySetCurrentAction("Take Shower");
         if (result)
         {
             SpriteControler.Instance.ChangeSortingOrder(1);
             SpriteControler.Instance.SetClothesState(false);
             SpriteControler.Instance.Censor.SetActive(true);
             useState = ObjectUseState.Preparation;
             PlayerCommands.JumpTo(this);
         }
         else
         {
             result.PrintErrorMessage();
         }
     }
 }
Exemplo n.º 2
0
 private void Update()
 {
     if (Input.GetButtonDown("AddCube") && !PlayerCommands.Get().isAddingTurret)
     {
         TryAddCubo();
     }
 }
        public override void BeforeEach()
        {
            base.BeforeEach();

            _playerQueries  = Container.Resolve <PlayerQueries>();
            _playerCommands = Container.Resolve <PlayerCommands>();
        }
Exemplo n.º 4
0
    public override void OnWork(CuboController user)
    {
        PlayerCommands.Get().OnCuboDestroyed();
        user.GetComponentInChildren <Selectable>().enabled = false;

        GameObject model = user.model;

        model.transform.DOPunchScale(new Vector3(1.025f, 0.8f, 1.025f), 0.25f, 0, 2f);

        Sequence seq = DOTween.Sequence();

        seq.Append(model.transform.DOLocalMoveY(5f, sacrificeTime).SetEase(Ease.InQuad));
        seq.Join(model.transform.DOScale(0f, sacrificeTime - 0.4f).SetEase(Ease.InQuad).SetDelay(0.4f));
        seq.Play();

        Camera.main.GetComponent <AudioSource>().PlayOneShot(sacrificeNoise);

        Timing.CallDelayed(sacrificeTime + 0.1f, delegate
        {
            Instantiate(workFxObj, transform.position + Vector3.up * 17f, Quaternion.LookRotation(Vector3.up, Vector3.left));
            power++;
            UIStatic.SetInt(UIStatic.CUR_SACRIFICE, power);
            Destroy(user.gameObject);

            if (power >= goalPower)
            {
                PlayerCommands.Get().Win();
            }
        });
    }
Exemplo n.º 5
0
        public HotkeyConfig(string data, HotkeyConfig def)
        {
            var split = data.Split('*');

            bool success = false;

            if (split.Length == 5)
            {
                try
                {
                    Command   = PlayerCommands.getCommandByName(split[0]);
                    Key       = (Key)Enum.Parse(typeof(Key), split[1]);
                    Modifiers = (ModifierKeys)Enum.Parse(typeof(ModifierKeys), split[2]);
                    Global    = bool.Parse(split[3]);
                    Enabled   = bool.Parse(split[4]);
                    success   = true;
                }
                catch {}
            }

            if (!success)
            {
                Key       = def.Key;
                Modifiers = def.Modifiers;
                Enabled   = def.Enabled;
            }
        }
Exemplo n.º 6
0
 public ReportTestHelper(
     BrandCommands brandCommands,
     BrandQueries brandQueries,
     IBrandRepository brandRepository,
     FakeBus bus,
     OfflineDepositCommands depositCommands,
     IGameServerIntegrationRepository gameServerIntegrationRepository,
     PaymentQueries paymentQueries,
     IPaymentRepository paymentRepository,
     IPermissionProvider permissionProvider,
     PlayerCommands playerCommands,
     PlayerQueries playerQueries,
     RoleService roleService,
     ISharedData sharedData,
     UserService userService,
     WalletCommands walletWalletCommands
     )
 {
     _brandCommands        = brandCommands;
     _brandQueries         = brandQueries;
     _brandRepository      = brandRepository;
     _bus                  = bus;
     _depositCommands      = depositCommands;
     _paymentQueries       = paymentQueries;
     _paymentRepository    = paymentRepository;
     _permissionProvider   = permissionProvider;
     _gsiRepository        = gameServerIntegrationRepository;
     _playerCommands       = playerCommands;
     _playerQueries        = playerQueries;
     _roleService          = roleService;
     _sharedData           = sharedData;
     _userService          = userService;
     _walletWalletCommands = walletWalletCommands;
 }
Exemplo n.º 7
0
 private void Use()
 {
     if (!IsInvoking(nameof(DisableOptions)) && !IsInvoking("EnableOptions"))
     {
         PlayerCommands.ActivateItem(Id);
     }
 }
Exemplo n.º 8
0
    public static void SetCommands(System.IntPtr ptr)
    {
        string value = Marshal.PtrToStringAuto(ptr);

        cmds    = JsonUtility.FromJson <PlayerCommands>(value);
        hasCmds = true;
    }
Exemplo n.º 9
0
 public void Damage(float _damage, PlayerCommands _toDamage)
 {
     if (isLocalPlayer)
     {
         CmdDamage(_damage, _toDamage.netId);
     }
 }
Exemplo n.º 10
0
 public PlayerSubscriber(
     IPlayerRepository playerRepository,
     PlayerCommands playerCommands)
 {
     _playerRepository = playerRepository;
     _playerCommands   = playerCommands;
 }
Exemplo n.º 11
0
        public void OnPointerClick(PointerEventData eventData)
        {
            var description = !string.Equals(_containerImage.sprite.name, UIConstants.ItemContainerDefaultSpriteName, StringComparison.CurrentCultureIgnoreCase) ? _containerImage.sprite.name.ToUpperInvariant() + "_DESCRIPTION" : string.Empty;

            GameObjectUtilities.FindGameObject("Game/Canvas/ItemPanel/ItemContainer_Inventory").GetComponent <ItemContainerBehaviour>().TryGetItem(out var inventory);
            if (_moveItem)
            {
                if (inventory && inventory.Id == _moveItem.Id)
                {
                    if (_moveItemContainer != null)
                    {
                        if (TryGetItem(out var containerItem) == false)
                        {
                            PlayerCommands.DropItem(_moveItem.Id, ContainerIndex);
                        }
                        else
                        {
                            PlayerCommands.SwapInventoryItem(containerItem.Id, ContainerIndex, _moveItem.Id);
                        }
                    }
                    else
                    {
                        if (TryGetItem(out var containerItem) == false)
                        {
                            PlayerCommands.DropAndActivateItem(_moveItem.Id, ContainerIndex);
                        }
                        else
                        {
                            PlayerCommands.SwapAndActivateInventoryItem(containerItem.Id, ContainerIndex, _moveItem.Id);
                        }
                    }
Exemplo n.º 12
0
    public IEnumerator TakingShower()
    {
        if (!GameLibOfMethods.canInteract)
        {
            GameLibOfMethods.cantMove = true;
            GameLibOfMethods.Walking  = false;

            GameLibOfMethods.animator.SetBool("Jumping", false);
            GameLibOfMethods.animator.SetBool("TakingShower", true);

            Emission.enabled = true;
            yield return(new WaitForEndOfFrame());

            SpriteControler.Instance.FaceDOWN();

            GameLibOfMethods.canInteract = true;
            yield return(new WaitForEndOfFrame());

            float timeWithFullBar = 0;

            while (!Input.GetKey(InteractionChecker.Instance.KeyToInteract) && !GameLibOfMethods.passedOut && !isBroken)
            {
                Stats.Status(Type.Hygiene).Add(HygieneGainAmount * Time.fixedDeltaTime);

                float chance = Random.Range(0f, 100f);
                if (chance <= breakChancePerSecond / 60)
                {
                    isBroken = true;
                    Break();
                }


                if (Stats.Status(Type.Hygiene).CurrentAmount >= Stats.Status(Type.Hygiene).MaxAmount)
                {
                    timeWithFullBar += Time.deltaTime;

                    if (timeWithFullBar >= 2)
                    {
                        GameLibOfMethods.CreateFloatingText("You are too clean for this.", 2);
                        break;
                    }
                }
                yield return(new WaitForFixedUpdate());
            }

            Emission.enabled = false;
            yield return(new WaitForEndOfFrame());

            PlayExitSound();


            GameLibOfMethods.animator.SetBool("TakingShower", false);
            yield return(new WaitForEndOfFrame());

            void act() => SpriteControler.Instance.ChangeSortingOrder(0);

            PlayerCommands.JumpOff(0, act);
        }
    }
Exemplo n.º 13
0
        private void Tile_Click(object sender, RoutedEventArgs e)
        {
            if (Window == null)
            {
                Window     = new CommandsGeneratorTemplate(this);
                Window.win = (Application.Current.MainWindow as IMainWindowCommands).AddWindow(Icon, Window, "命令生成器", this);
                Window.win.WindowClosed += Win_WindowClosed;
            }
            object content = null;
            string title   = (sender as Tile).Title;

            switch (title)
            {
            case "基础命令": content = new BasicCommands(Window); break;

            case "服务器命令": content = new ServerCommands(Window); break;

            case "实体命令": content = new EntityCommands(Window); break;

            case "玩家命令": content = new PlayerCommands(Window); break;

            case "Json书": content = new Book(Window); break;

            case "告示牌": content = new Sign(Window); break;

            case "消息文本": content = new Tellraw(Window); break;

            case "显示标题": content = new Title(Window); break;

            case "记分板目标": content = new ScoreboardObjective(Window); break;

            case "记分板玩家": content = new ScoreboardPlayers(Window); break;

            case "记分板队伍": content = new ScoreboardTeam(Window); break;

            case "物品NBT": content = new ItemNBT(Window); break;

            case "实体NBT": content = new EntityNBT(Window); break;

            case "物品与生成": content = new GetElement(); break;

            case "检测与执行": content = new ExecuteAndDetect(); break;

            case "方块NBT/放置填充方块": content = new SetBlocks(Window); break;

            case "村民交易": content = new VillagerTrade(Window); break;

            case "刷怪笼": content = new MobSpawner(Window); break;

            case "烟花": content = new Firework(Window); break;

            case "旗帜/盾牌": content = new Banners(Window); break;

            case "药水/药水箭": content = new Potion(Window); break;

            case "盔甲架": content = new ArmorStand(Window); break;
            }
            Window.AddPage(title, content);
        }
Exemplo n.º 14
0
        public override void BeforeEach()
        {
            base.BeforeEach();

            _playerCommands          = Container.Resolve <PlayerCommands>();
            _emailNotificationWorker = Container.Resolve <EmailNotificationWorker>();
            _smsNotificationWorker   = Container.Resolve <SmsNotificationWorker>();
        }
Exemplo n.º 15
0
 public void Interact()
 {
     if (Stats.Status(Energy).CurrentAmount <= 5 || Stats.Status(Health).CurrentAmount <= 5)
     {
         return;
     }
     PlayerCommands.JumpTo(this);
 }
Exemplo n.º 16
0
 public static PlayerCommands Get()
 {
     if (m_instance == null)
     {
         m_instance = GameObject.FindWithTag("Player").GetComponent <PlayerCommands>();
     }
     return(m_instance);
 }
Exemplo n.º 17
0
 private void Awake()
 {
     commands      = GetComponent <PlayerCommands>();
     movement      = GetComponent <PlayerMovement>();
     arm           = GetComponent <PlayerArm>();
     bodyCollider  = GetComponent <CapsuleCollider2D>();
     spriteColorer = GetComponent <SpriteColorer>();
 }
Exemplo n.º 18
0
        public static void LoadDataBuffers()
        {
            //DisabledQuikEdit();

            Stopwatch allData = new Stopwatch();

            allData.Start();
            int count = 0;

            count += DataProvider.LoadEtc(@".\NX\Etc.nx");

            ManualResetEvent[] handles = new ManualResetEvent[6];
            for (int i = 0; i < handles.Count(); i++)
            {
                handles[i] = new ManualResetEvent(false);
            }

            ThreadPool.QueueUserWorkItem(new WaitCallback(LoadMobs), handles[2]);
            ThreadPool.QueueUserWorkItem(new WaitCallback(LoadEquips), handles[0]);
            ThreadPool.QueueUserWorkItem(new WaitCallback(LoadItems), handles[1]);
            ThreadPool.QueueUserWorkItem(new WaitCallback(LoadSkills), handles[3]);
            ThreadPool.QueueUserWorkItem(new WaitCallback(LoadQuests), handles[4]);

            handles[2].WaitOne();                                                 //Wait for mob thread to finish
            ThreadPool.QueueUserWorkItem(new WaitCallback(LoadMaps), handles[5]); //Map needs mob wz info, so wait until mobs finished

            WaitHandle.WaitAll(handles);
            //Always do strings after the other WZs!
            count += DataProvider.LoadStrings(@".\NX\String.nx");
            ServerConsole.Info("{0} Strings loaded", count);

            ServerConsole.Info("Finished loading .NX in {0} ms", (int)allData.ElapsedMilliseconds);

            Stopwatch sw = new Stopwatch();

            sw.Start();
            count = DataProvider.LoadScripts();
            ServerConsole.Info("{0} Scripts loaded in {1} ms", count, (int)sw.ElapsedMilliseconds);
            sw.Reset();

            /*
             * sw.Start();
             * Count = LoadCashShopItems();
             * ServerConsole.Info(String.Format("{0} CashShop items loaded in {1} ms", Count, (int)sw.ElapsedMilliseconds));
             * sw.Reset();
             */
            sw.Start();
            count  = AdminCommands.ReloadCommands();
            count += GMCommands.ReloadCommands();
            count += PlayerCommands.ReloadCommands();
            count += DonorCommands.ReloadCommands();
            ServerConsole.Info("{0} Commands loaded in {1} ms", count, (int)sw.ElapsedMilliseconds);
            sw.Reset();
            LoadMonsterDrops();
            allData.Stop();
            ServerConsole.Info("All data loaded in {0} ms", (int)allData.ElapsedMilliseconds);
            ServerConsole.Info("==============================================");
        }
Exemplo n.º 19
0
 private void TryAction(List <ItemList.ItemInfo> itemsToCook)
 {
     if (CanAct())
     {
         CookingHandler.EnableCanvas     = false;
         GameLibOfMethods.doingSomething = true;
         PlayerCommands.MoveTo(PlayerStandPosition, () => StartAction(itemsToCook).Start());
     }
 }
Exemplo n.º 20
0
 private void TryCook(List <ItemList.ItemInfo> itemsToCook)
 {
     if (CanCook())
     {
         CookingHandler.EnableCanvas     = false;
         GameLibOfMethods.doingSomething = true;
         PlayerCommands.MoveTo(standArea.position, () => StartCooking(itemsToCook).Start());
     }
 }
Exemplo n.º 21
0
 // Start is called before the first frame update
 void Start()
 {
     video          = GetComponent <VideoController>();
     audio          = GetComponent <AudioController>();
     sub            = GetComponent <Subtitles>();
     hints          = GetComponent <Hints>();
     playerCommands = GetComponent <PlayerCommands>();
     gameLoop       = StartCoroutine(GameLoop());
 }
Exemplo n.º 22
0
    void Update()
    {
        if (Input.GetButtonDown("AddTurret"))
        {
            TryAddTurret();
        }

        turretCost.text = PlayerCommands.Get().GetCurTurretCost().ToString();
    }
Exemplo n.º 23
0
 void Start()
 {
     player               = GameObject.FindGameObjectWithTag("Player");
     playerCom            = player.GetComponent <PlayerCommands>();
     playerHealthRemain   = player.GetComponent <PlayerCommands>().healthRemaining;
     playerStartingHealth = player.GetComponent <PlayerCommands>().StartingHealth;
     playerComponents     = player.GetComponent <PlayerCommands>().Components;
     playerHealthRemain   = playerStartingHealth;
 }
Exemplo n.º 24
0
    //Callback (Executed locally on the server)
    public void OnGameObjectInteraction(NetworkMessage netMsg)
    {
        InteractionMessage msg = netMsg.ReadMessage <InteractionMessage> ();

        Debug.Log("Message received " + msg.ToString());
        NetworkInstanceId netId = new NetworkInstanceId(msg.netId);
        GameObject        go    = NetworkServer.FindLocalObject(netId);

        PlayerCommands.OnGameObjectInteraction(go, msg.method, msg.args);
    }
Exemplo n.º 25
0
 public override void OnWork(CuboController user)
 {
     base.OnWork(user);
     if (!users.Contains(user))
     {
         users.Add(user);
     }
     PlayerCommands.Get().AddMoney(GetMoneyPerWork(user));
     Camera.main.GetComponent <AudioSource>().PlayOneShot(moneyNoise);
 }
Exemplo n.º 26
0
 protected PlayerCommands GetCmd()
 {
     if (cmd == null)
     {
         cmd = AWConfig.GetInstance()
               .GetLocalPlayer()
               .GetComponent <PlayerCommands> ();
     }
     return(cmd);
 }
Exemplo n.º 27
0
 public void UnloadFromCar()
 {
     if (anim.GetBool("PlayerIsInCar") == true)
     {
         PlayerAnimationHelper.ResetPlayer();
         PlayerCommands.MoveTo(PlayerCommands.LastPositionBeforeWalk, PlayerAnimationHelper.ResetPlayer);
         anim.SetBool("PlayerIsInCar", false);
         JobManager.Instance.isWorking = false;
         CarDriveFromHouseToLeft();
     }
 }
Exemplo n.º 28
0
    public void GoInCar()
    {
        PlayerCommands.MoveTo(PlayerStandPosition, delegate {
            CarDriveFromHouseToLeft();
            Player.anim.SetBool("HidePlayer", true);
        });

        anim.SetBool("PlayerIsInCar", true);
        JobManager.Instance.isWorking = true;
        IgnorePlayer = true;
    }
Exemplo n.º 29
0
        public override void Interact()
        {
            var result = TrySetCurrentAction("Cardio");

            if (result)
            {
                PlayerCommands.JumpTo(this);
            }
            else
            {
                result.PrintErrorMessage();
            }
        }
Exemplo n.º 30
0
    void Start()
    {
        selectionBox = new List <GameObject>();

        for (int x = 0; x != selectionBoxParent.transform.childCount; x++)
        {
            selectionBox.Add(selectionBoxParent.transform.GetChild(x).gameObject);
        }

        selectionBox.Add(gameObject);

        pc = GameObject.Find("PlayerController").GetComponent <PlayerCommands>();
    }