Exemplo n.º 1
0
        public void AddCharacter(CharacterLogic logic)
        {
            GameObject         obj  = GameGOW.Get().ResourceMgr.GetRes("Prefab/CharacterLogic");
            CharacterLogicView view = obj.GetComponent <CharacterLogicView>();

            view.SetCharacterLogic(logic);
            obj.transform.parent         = m_pZSort;
            m_dicCharacterView[logic.ID] = view;
        }
Exemplo n.º 2
0
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (this.character == null)
        {
            this.character = animator.GetComponent <CharacterLogic>();
        }

        this.character.desiredAimingWeight = 0.0f;
    }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="config"></param>
        public EsiClient(IOptions <EsiConfig> _config)
        {
            config = _config.Value;
            client = new HttpClient(new HttpClientHandler
            {
                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
            });

            // Enforce user agent value
            if (string.IsNullOrEmpty(config.UserAgent))
            {
                throw new ArgumentException("For your protection, please provide an X-User-Agent value. This can be your character name and/or project name. CCP will be more likely to contact you rather than just cut off access to ESI if you provide something that can identify you within the New Eden galaxy.");
            }
            else
            {
                client.DefaultRequestHeaders.Add("X-User-Agent", config.UserAgent);
            }

            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
            client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("deflate"));

            SSO                  = new SsoLogic(client, config);
            Alliance             = new AllianceLogic(client, config);
            Assets               = new AssetsLogic(client, config);
            Bookmarks            = new BookmarksLogic(client, config);
            Calendar             = new CalendarLogic(client, config);
            Character            = new CharacterLogic(client, config);
            Clones               = new ClonesLogic(client, config);
            Contacts             = new ContactsLogic(client, config);
            Contracts            = new ContractsLogic(client, config);
            Corporation          = new CorporationLogic(client, config);
            Dogma                = new DogmaLogic(client, config);
            FactionWarfare       = new FactionWarfareLogic(client, config);
            Fittings             = new FittingsLogic(client, config);
            Fleets               = new FleetsLogic(client, config);
            Incursions           = new IncursionsLogic(client, config);
            Industry             = new IndustryLogic(client, config);
            Insurance            = new InsuranceLogic(client, config);
            Killmails            = new KillmailsLogic(client, config);
            Location             = new LocationLogic(client, config);
            Loyalty              = new LoyaltyLogic(client, config);
            Mail                 = new MailLogic(client, config);
            Market               = new MarketLogic(client, config);
            Opportunities        = new OpportunitiesLogic(client, config);
            PlanetaryInteraction = new PlanetaryInteractionLogic(client, config);
            Routes               = new RoutesLogic(client, config);
            Search               = new SearchLogic(client, config);
            Skills               = new SkillsLogic(client, config);
            Sovereignty          = new SovereigntyLogic(client, config);
            Status               = new StatusLogic(client, config);
            Universe             = new UniverseLogic(client, config);
            UserInterface        = new UserInterfaceLogic(client, config);
            Wallet               = new WalletLogic(client, config);
            Wars                 = new WarsLogic(client, config);
        }
Exemplo n.º 4
0
    public void SetChara(CharacterLogic character)
    {
        disposable?.Dispose();
        disposable         = new CompositeDisposable();
        characterName.text = character.name;
        characterTeam.text = character.team.ToString();
        disposable.Add(character.Hp.Subscribe(hp =>
        {
            characterHp.text = $"{hp} / {character.maxHp.Value}";
        }));
        disposable.Add(character.atk.Subscribe(atk =>
        {
            characterAtk.text = atk.ToString();
        }));
        disposable.Add(character.def.Subscribe(def =>
        {
            characterDef.text = def.ToString();
        }));
        disposable.Add(character.isDead.Subscribe(isDead =>
        {
            if (isDead)
            {
                atkButton.interactable = false;
            }
            else
            {
                atkButton.interactable = true;
            }
        }));
        for (int i = 0; i < 3; i++)
        {
            if (i < character.skills.Count)
            {
                skillButtons[i].gameObject.SetActive(true);

                skillButtons[i].onClick.RemoveAllListeners();
                SkillBase skill       = character.skills[i];
                Button    skillButton = skillButtons[i];
                skillButton.interactable = skill.canCast;
                disposable.Add(GameManager.Instance.turnBeginSubject.Subscribe(turn =>
                {
                    skillButton.interactable = skill.canCast;
                }));
                skillButtons[i].onClick.AddListener(() =>
                {
                    GameManager.Instance.OnClickSkill(skill);
                    skillButton.interactable = skill.canCast;
                });
                skillButtons[i].transform.GetChild(0).GetComponent <Text>().text = skill.skillName;
            }
            else
            {
                skillButtons[i].gameObject.SetActive(false);
            }
        }
    }
Exemplo n.º 5
0
    public void ShowEffectTargetRange(CharacterLogic logic, Vector2Int mouseTilePos)
    {
        Vector2Int tilePos = logic.GetTileCoord();

        //List<Vector2Int> highlightRange = new List<Vector2Int> { mouseTilePos };
        logic.BattleInfo.SetEffectTarget(mouseTilePos);
        List <Vector2Int> highlightRange = logic.BattleInfo.TargetEffectRanges;

        pathShower.ShowHighLightTiles(highlightRange);
    }
Exemplo n.º 6
0
 public bool CheckBattleTalkEvent(CharacterLogic chLogic)
 {
     IActionMenu.UIActionButtonInfo location = new IActionMenu.UIActionButtonInfo();
     if (GetBattleAction_BattleTalk(chLogic, ref location))
     {
         BattleActionMenu.AddAction(location);
         return(true);
     }
     return(false);
 }
Exemplo n.º 7
0
    public void BattleAction_Attack()
    {
        BattleActionMenu.Hide();
        //battleManager.ClearRangeAction();
        CharacterLogic logic = battleManager.CurrentCharacterLogic;

        BuildBattleSelectWeaponMenu(logic);
        BattleSelectWeaponMenu.Show();
        MenuUndoAction.Push(UndoShowBattleActionMenu);
    }
Exemplo n.º 8
0
    public void SetDataFromDef(PlayerDef DefaultData)
    {
        logic = new CharacterLogic(DefaultData);

        logic.careerDef = ResourceManager.GetCareerDef(logic.characterDef.Career);
        if (logic.careerDef == null)
        {
            Debug.LogError("不存在的career def");
        }
    }
Exemplo n.º 9
0
    public void Initialize(CharacterLogic character)
    {
        this.character = character;
        transform      = character.GetComponent <Transform>();
        rigidbody      = character.GetComponent <Rigidbody>();
        animator       = character.GetComponent <Animator>();

        headingAngleController    = ControllerPID.CreateInstance();
        angularVelocityController = ControllerPID.CreateInstance();
    }
Exemplo n.º 10
0
    public void BuildBattleSelectWeaponMenu(CharacterLogic chLogic)
    {
        BattleSelectWeaponMenu.Clear();
        List <WeaponItem> weaponItems = chLogic.Info.Items.GetAllWeapons();

        foreach (var v in weaponItems)
        {
            var weaponAction = new IActionMenu.UIActionButtonInfo(v.GetName(), () => BattleAction_SelectWeapon(v));
            BattleSelectWeaponMenu.AddAction(weaponAction);
        }
    }
Exemplo n.º 11
0
    /// <summary>
    /// 检查是否拥有位置事件
    /// </summary>
    /// <param name="chLogic"></param>
    /// <param name="info"></param>
    /// <returns></returns>
    public bool GetBattleAction_Location(CharacterLogic chLogic, ref IActionMenu.UIActionButtonInfo info)
    {
        var locationEvent = chapterManager.Event.EventInfo.GetLocationEvent(chLogic.GetTileCoord(), chLogic.GetID());

        if (locationEvent == null)
        {
            Debug.Log("没有Location事件");
            return(false);
        }
        Debug.Log("找到相匹配的Location Event" + locationEvent);

        EnumActionType actionType = EnumActionType.OpenTreasureBox;

        if (locationEvent.Caption == EventInfoCollection.EnumLocationEventCaption.占领)
        {
            actionType = EnumActionType.All;
        }
        if (locationEvent.Caption == EventInfoCollection.EnumLocationEventCaption.访问)
        {
            actionType = EnumActionType.Visit;
        }

        info.name   = locationEvent.GetButtonText();
        info.action = () =>
        {
            gameMode.BeforePlaySequence();
            HideBattlaActionMenu(false);
            if (locationEvent.Sequence != null)
            {
                locationEvent.Execute(chapterManager.Event.EventInfo, () =>
                {
                    gameMode.AfterPlaySequence();
                    if (locationEvent.Caption != EventInfoCollection.EnumLocationEventCaption.占领)//如果是占领,则不再弹出选项菜单了
                    {
                        ShowBattleActionMenu(ActionMenuState, chLogic);
                    }
                });
            }

            chLogic.ConsumeActionPoint(actionType);

            if (locationEvent.Caption == EventInfoCollection.EnumLocationEventCaption.占领)
            {
                //gameMode.ChapterManager.CheckWin_Seize();
            }
            if (locationEvent.Caption == EventInfoCollection.EnumLocationEventCaption.开门)
            {
                //gameMode.GridTileManager.OpenDoor(new Vector2Int(0, 0));
            }
        };
        info.enable = chLogic.IsActionEnable(actionType);
        return(true);
    }
Exemplo n.º 12
0
 //[RuntimeInitializeOnLoadMethod]
 //public static void LoadFromRecord() {
 //    CharacterInfo info = new CharacterInfo();
 //   info= info.Load<CharacterInfo>();
 //    Debug.Log(info.Items.Weapons.Count);
 //}
 public CharacterInfo(CharacterLogic Logic)
 {
     ID        = Logic.GetID();
     Level     = Logic.GetLevel();
     Exp       = Logic.GetExp();
     Career    = Logic.GetCareer();
     Attribute = Logic.GetAttribute();
     CurrentHP = Logic.GetCurrentHP();
     MaxHP     = Logic.GetMaxHP();
     Items     = new ItemGroup();
     Skills    = new SkillGroup();
 }
Exemplo n.º 13
0
 public void Attack(CharacterLogic target)
 {
     if (target.team != team)
     {
         int finalATK = (int)(atk.Value * GameDefine.ATKMap[Mathf.Abs(target.pos.x - pos.x)]);
         target.Damage(finalATK);
     }
     else
     {
         Debug.LogError("can not attack teammate");
     }
 }
Exemplo n.º 14
0
    public void BuildBattleActionMenu_Main(CharacterLogic chLogic)
    {
        BattleActionMenu.Clear();
        var point = chLogic.GetActionPoint();

        BattleActionMenu.SetActionPoint(point);
        CheckLocationEvent(chLogic);
        CheckBattleTalkEvent(chLogic);
        CheckMoveAction(chLogic);
        CheckAttackAction(chLogic);
        CheckWaitAction(chLogic);
    }
Exemplo n.º 15
0
 public void ShowBattleActionMenu(EActionMenuState state, CharacterLogic chLogic)
 {
     HideBattleMainMenu();
     switch (state)
     {
     case EActionMenuState.Main:
         BuildBattleActionMenu_Main(chLogic);
         break;
     }
     eActionMenuState = state;
     BattleActionMenu.Show();
 }
Exemplo n.º 16
0
    private bool Apply(CharacterLogic character)
    {
        switch (Type)
        {
        case PickupType.Heart:
            return(character.Heal(1));

        default:
            Debug.Assert(false);
            break;
        }
        return(true);
    }
Exemplo n.º 17
0
 public void Init(CharacterLogic ch, int index = -1)//数值在GameChar里面有函数计算
 {
     Text_Attack.text = ch.GetAttack().ToString();
     Text_Hit.text = ch.GetHit().ToString();
     Text_Critical.text = ch.GetCritical().ToString();
     Text_Range.text = ch.GetAttackRangeMin() + "-" + ch.GetAttackRangeMax();
     Text_Anger.text = ch.GetAnger().ToString();
     Text_AttackSpeed.text = ch.GetAttackSpeed().ToString();
     Text_AttackEffect.text = "攻击特效显示";//medifyneed
     Text_Avoid.text = ch.GetAvoid().ToString();
     Text_critAvoid.text = ch.GetCriticalAvoid().ToString();
     Text_Movement.text = ch.GetMovement().ToString();
 }
Exemplo n.º 18
0
    public static SkillBase LoadSkill(int skillId, CharacterLogic character)
    {
        ISheet    sheet            = workbook.GetSheet(skillId.ToString());
        string    skillLogicScript = sheet.GetRow(1).GetCell(1).GetString();
        Type      skillType        = Type.GetType(skillLogicScript);
        string    skillName        = sheet.GetRow(2).GetCell(1).GetString();
        int       coolDown         = sheet.GetRow(3).GetCell(1).GetInt();
        bool      selectable       = sheet.GetRow(4).GetCell(1).GetBoolean();
        SkillBase skill            = Activator.CreateInstance(skillType, skillId, skillName, coolDown, selectable, character) as SkillBase;

        skill.LoadCustomProperty(sheet);
        return(skill);
    }
Exemplo n.º 19
0
 public void AddCharacter(CharacterLogic character, Sprite sprite, Vector2Int pos)
 {
     if (character.team == Team.Team1)
     {
         int index = pos.x + pos.y * 4;
         team1Grid[index].SetCharacter(character, sprite, pos, Team.Team1);
     }
     else
     {
         int index = pos.x + pos.y * 4;
         team2Grid[index].SetCharacter(character, sprite, pos, Team.Team2);
     }
 }
Exemplo n.º 20
0
    private void SetupCharacter(GameObject character, Character characterInfo)
    {
        CharacterLogic characterLogic = character.GetComponent <CharacterLogic>();

        characterLogic.Attach(gameplayController, cardController, doorController, mainCamera);
        characterLogic.ApplyInfo(characterInfo);

        // Start character
        characterLogic.Init(infoRandomizer.RandomNumber(GameConfiguration.minPatientLevel, GameConfiguration.maxPatientLevel));

        // Send Object to Gameplay Controller
        gameplayController.SetInfo(character);
    }
Exemplo n.º 21
0
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (this.character == null)
        {
            this.character = animator.GetComponent <CharacterLogic>();
        }

        if (this.leftHandGrip == null)
        {
            this.leftHandGrip = this.character.weapon.transform.Find("LeftHandGrip").gameObject;
        }

        this.character.desiredLeftHandWeight = this.desiredWeight;
    }
Exemplo n.º 22
0
    // Use this for initialization
    IEnumerator Start()
    {
        // Cache the character script
        _character = GameObject.Find("character").GetComponent <CharacterLogic>();

        // Put the character near to the bed
        _character.transform.position = characterSpawnObject.position;
        _character.transform.rotation = characterSpawnObject.rotation;

        // Play the thud noise
        _character.audio.PlayOneShot(thudClip);

        // Set the looking camera to the current camera
        _character.lookingCamera = GameObject.Find("Main Camera").GetComponent <Camera>();

        // Give the character the bed game object
        _character.bed = GameObject.Find("Bed");

        // Disable the top light
        _character.topLight.enabled = false;

        // Change the character state
        _character.currentState = CharacterLogic.States.GettingUpFromGround;

        // Disable character input
        _character.inputEnabled = false;

        // Wait for the getting up animation to end
        yield return(StartCoroutine(WaitForState(_character, CharacterLogic.States.Idle)));

        // Wait before going to bed
        yield return(new WaitForSeconds(delayBeforeGoingToBed));

        // Make the character going to bed
        _character.currentState = CharacterLogic.States.GoingToBed;

        // Wait for the going to bed animation to end
        yield return(StartCoroutine(WaitForState(_character, CharacterLogic.States.InBed)));

        // Switch the the secondary camera
        mainCamera.SetActive(false);
        secondaryCamera.SetActive(true);

        // Wait some time before closing eyes
        yield return(new WaitForSeconds(eyeCloseDelay));

        // Make the character eyes closed
        _character.CloseEyes();
    }
Exemplo n.º 23
0
 public override void Continue()
 {
     gameMode.UIManager.GetItemOrMoney.Hide();
     if (PlayerID == -1)
     {
         Logic = gameMode.BattleManager.CurrentCharacterLogic;
     }
     else
     {
         Logic = gameMode.ChapterManager.GetCharacterFromID(PlayerID).Logic;
     }
     Logic.SetLevel(Info.endLevel);
     Logic.SetExp(Info.endExp);
     base.Continue();
 }
Exemplo n.º 24
0
    public void ShowAttackInfo(CharacterLogic currentCharacterLogic, CharacterLogic logic)
    {
        WeaponItem equipWeapon = currentCharacterLogic.Info.Items.GetEquipWeapon();
        var        def         = ResourceManager.GetWeaponDef(equipWeapon.ID);
        int        afterHP     = currentCharacterLogic.GetCurrentHP() - BattleLogic.GetAttackDamage(logic, currentCharacterLogic);

        Left_BattleAttackInfo.Show(currentCharacterLogic.GetPortrait(), def.Icon, def.CommonProperty.Name, currentCharacterLogic.GetMaxHP(), currentCharacterLogic.GetCurrentHP(), afterHP,
                                   currentCharacterLogic.GetHit(), BattleLogic.GetAttackDamage(currentCharacterLogic, logic), currentCharacterLogic.GetCritical(), BattleLogic.GetAttackCount(currentCharacterLogic, logic));

        equipWeapon = logic.Info.Items.GetEquipWeapon();
        def         = ResourceManager.GetWeaponDef(equipWeapon.ID);
        afterHP     = logic.GetCurrentHP() - BattleLogic.GetAttackDamage(currentCharacterLogic, logic);
        Right_BattleAttackInfo.Show(logic.GetPortrait(), def.Icon, def.CommonProperty.Name, logic.GetMaxHP(), logic.GetCurrentHP(), afterHP,
                                    logic.GetHit(), BattleLogic.GetAttackDamage(logic, currentCharacterLogic), logic.GetCritical(), BattleLogic.GetAttackCount(logic, currentCharacterLogic));
    }
Exemplo n.º 25
0
 public void SetCharacter(CharacterLogic character, Sprite iconSprite, Vector2Int pos, Team team)
 {
     this.team = team;
     this.pos  = pos;
     this.characterView.Init(character, iconSprite);
     characterLogic = character;
     hasCharacter   = true;
     dispose        = character.isDead.Subscribe(isDead => {
         if (isDead)
         {
             hasCharacter = false;
             dispose?.Dispose();
         }
     });
 }
Exemplo n.º 26
0
 public void ClientInventoryItemClicked(ItemButton itemButton)
 {
     if (itemButton.InventoryItem != null)
     {
         BaseItemContainer baseItem = itemButton.InventoryItem.ItemContainer;
         if (baseItem != null && baseItem.ItemUseType == BaseItemContainer.EItemUseType.Active)
         {
             if (baseItem.AbilityBase)
             {
                 CharacterLogic characterLogic = m_entity.EntityLogic as CharacterLogic;
                 EAttackType    attackType     = (EAttackType)Enum.Parse(typeof(EAttackType), "ItemSlot" + itemButton.Slot);
                 characterLogic.TryToCastAbilityOnClient(attackType, false);
             }
         }
     }
 }
Exemplo n.º 27
0
        private void GameScreen_Loaded(object sender, RoutedEventArgs e)
        {
            MainWindow win = (MainWindow)Window.GetWindow(this);

            if (win.IsNewGame)
            {
                this.GameModel      = new GameModel(win.PlayerName);
                this.ballLogic      = new BallLogic(this.GameModel.Ball);
                this.characterLogic = new CharacterLogic(this.GameModel.Ball, this.GameModel.Character, this.GameModel.Score, this.GameModel.Timer);
                this.scoreLogic     = new ScoreLogic(this.GameModel.Score, this.GameModel.Ball);
                this.timerLogic     = new TimerLogic(this.GameModel.Timer, this.GameModel);
            }
            else
            {
                this.GameModel = win.GameModel;
                this.GameModel.Character.Blocked = false;
                this.ballLogic      = new BallLogic(this.GameModel.Ball);
                this.characterLogic = new CharacterLogic(this.GameModel.Ball, this.GameModel.Character, this.GameModel.Score, this.GameModel.Timer);
                this.scoreLogic     = new ScoreLogic(this.GameModel.Score, this.GameModel.Ball);
                this.timerLogic     = new TimerLogic(this.GameModel.Timer, this.GameModel);
            }

            this.render = new GameRenderer(this.GameModel);

            if (win != null)
            {
                this.tickTimer        = new DispatcherTimer();
                this.tickTimerSeconds = new DispatcherTimer
                {
                    Interval = TimeSpan.FromMilliseconds(1000),
                };
                this.tickTimer.Interval = TimeSpan.FromMilliseconds(20);

                this.tickTimer.Tick        += this.Timer_Tick;
                this.tickTimerSeconds.Tick += this.Timer_Tick_Seconds;

                this.tickTimerSeconds.Start();
                this.tickTimer.Start();

                win.KeyDown += this.Win_KeyDown;
                win.KeyUp   += this.Win_KeyUp;
            }

            this.ballLogic.RefreshScreen += (obj, args) => this.InvalidateVisual();
            this.InvalidateVisual();
        }
Exemplo n.º 28
0
    public static List <BattleAttackInfo> GetAttackInfo(CharacterLogic player, CharacterLogic enemy)
    {
        List <BattleAttackInfo> r = new List <BattleAttackInfo>();
        var atkA           = player.Info.Attribute;
        var defA           = enemy.Info.Attribute;
        BattleAttackInfo i = new BattleAttackInfo(player, enemy);

        i.Process();
        r.Add(i);
        if (IsDead(i, enemy) == false && IsCounterAttack(player, enemy))
        {
            BattleAttackInfo j = new BattleAttackInfo(enemy, player);
            j.Process();
            r.Add(j);
        }
        return(r);
    }
Exemplo n.º 29
0
    public static List <BattleAttackEstimateInfo> GetEstimateAttackInfo(CharacterLogic attacker, CharacterLogic defender)
    {
        List <BattleAttackEstimateInfo> r = new List <BattleAttackEstimateInfo>();
        BattleAttackEstimateInfo        i = new BattleAttackEstimateInfo();

        i.Damage = GetDamage(attacker, defender);
        i.Hit    = GetHit(attacker, defender);
        i.Times  = GetAttackTimes(attacker, defender);
        r.Add(i);
        if (IsCounterAttack(attacker, defender))
        {
            BattleAttackEstimateInfo j = new BattleAttackEstimateInfo();
            j.Damage = GetDamage(defender, attacker);
            j.Hit    = GetHit(defender, attacker);
            j.Times  = GetAttackTimes(defender, attacker);
            r.Add(j);
        }
        return(r);
    }
        public void TestTryHitBall()
        {
            this.mockedBall      = new Mock <IBallModel>(MockBehavior.Default);
            this.mockedCharacter = new Mock <ICharacterModel>(MockBehavior.Default);
            this.mockedTimer     = new Mock <ITimerModel>(MockBehavior.Default);
            this.mockedScore     = new Mock <IScoreModel>(MockBehavior.Default);

            //this.mockedBall.Setup(mock => mock.Area.IntersectsWith(It.IsAny<Rect>())).Returns(true);

            CharacterLogic characterLogic = new CharacterLogic(
                this.mockedBall.Object,
                this.mockedCharacter.Object,
                this.mockedScore.Object,
                this.mockedTimer.Object);

            characterLogic.TryHitBall();
            //Assert.That(true, Is.EqualTo(characterLogic.TryHitBall()));
            this.mockedBall.VerifySet(mock => mock.Area);
        }