Пример #1
0
        private Transaction <PolymorphicAction <ActionBase> > RankingReward()
        {
            // private 테스트용 임시 로직 변경
            var index = (int)_chain.Tip.Index / GameConfig.WeeklyArenaInterval;
            var weeklyArenaAddress = WeeklyArenaState.DeriveAddress(index);
            var weeklyArenaState   = new WeeklyArenaState(_chain.GetState(weeklyArenaAddress));
            var actions            = new List <PolymorphicAction <ActionBase> >
            {
                new RankingReward
                {
                    gold1          = 50,
                    gold2          = 30,
                    gold3          = 10,
                    agentAddresses = weeklyArenaState.GetAgentAddresses(3),
                }
            };

            return(_chain.MakeTransaction(_privateKey, actions.ToImmutableHashSet()));
        }
Пример #2
0
        public void GetAgentAddresses()
        {
            var privateKey   = new PrivateKey();
            var agentAddress = privateKey.PublicKey.ToAddress();

            var avatarAddress = agentAddress.Derive("avatar");
            var avatarState   = new AvatarState(avatarAddress, agentAddress, 0, _tableSheets, new GameConfigState());

            var avatarAddress2 = agentAddress.Derive("avatar2");
            var avatarState2   = new AvatarState(avatarAddress2, agentAddress, 0, _tableSheets, new GameConfigState());

            var state = new WeeklyArenaState(0);

            state.Set(avatarState, _tableSheets.CharacterSheet);
            state[avatarAddress].Activate();
            state.Set(avatarState2, _tableSheets.CharacterSheet);
            state[avatarAddress2].Activate();

            Assert.Single(state.GetAgentAddresses(2));
        }