Exemplo n.º 1
0
    public void OnAnyAllocationNinja(GameEntity entity, SCAllocationNinja value)
    {
        var mapImage = transform.Find("ChooseNinjaWindowMapImage").GetComponent <Image>();

        mapImage.sprite = Resources.Load <Sprite>("Image/UI/MapImage/" + value.map.mapName);

        var mapName = transform.Find("ChooseNinjaWindowMapName").GetComponent <Text>();

        mapName.text = _context.mapConfig.list[value.map.mapName].Name;

        var battleType = transform.Find("ChooseNinjaWindowBattleType").GetComponent <Text>();

        switch (value.matchType)
        {
        case 1:
            battleType.text = "遭遇战";
            break;

        case 2:
            battleType.text = "攻防战";
            break;

        case 3:
            battleType.text = "争夺战";
            break;

        default:
            battleType.text = "未知";
            break;
        }
    }
Exemplo n.º 2
0
    public void ReplaceAllocationNinjaNotification(SCAllocationNinja newValue)
    {
        var index     = GameComponentsLookup.AllocationNinjaNotification;
        var component = (AllocationNinjaNotificationComponent)CreateComponent(index, typeof(AllocationNinjaNotificationComponent));

        component.value = newValue;
        ReplaceComponent(index, component);
    }
    public void AddAllocationNinja(SCAllocationNinja newValue)
    {
        var index     = GameComponentsLookup.AllocationNinja;
        var component = (AllocationNinjaComponent)CreateComponent(index, typeof(AllocationNinjaComponent));

        component.value = newValue;
        AddComponent(index, component);
    }
Exemplo n.º 4
0
    public GameEntity SetAllocationNinjaNotification(SCAllocationNinja newValue)
    {
        if (hasAllocationNinjaNotification)
        {
            throw new Entitas.EntitasException("Could not set AllocationNinjaNotification!\n" + this + " already has an entity with AllocationNinjaNotificationComponent!",
                                               "You should check if the context already has a allocationNinjaNotificationEntity before setting it or use context.ReplaceAllocationNinjaNotification().");
        }
        var entity = CreateEntity();

        entity.AddAllocationNinjaNotification(newValue);
        return(entity);
    }
Exemplo n.º 5
0
    public void ReplaceAllocationNinjaNotification(SCAllocationNinja newValue)
    {
        var entity = allocationNinjaNotificationEntity;

        if (entity == null)
        {
            entity = SetAllocationNinjaNotification(newValue);
        }
        else
        {
            entity.ReplaceAllocationNinjaNotification(newValue);
        }
    }
    private IEnumerator SwitchChooseNinjaWindow(SCAllocationNinja allocationNinja)
    {
        yield return(_context.coroutineService.instance.WaitForSeconds(2));

        var e = _context.CreateEntity();

        e.ReplaceUiOpen("ChooseNinjaWindow");
        e.ReplaceName("ChooseNinjaWindow");
        foreach (var ui in _context.GetEntitiesWithName("SearchBattleWindow"))
        {
            ui.isUiClose = true;
        }

        yield return(_context.coroutineService.instance.WaitForEndOfFrame());

        yield return(_context.coroutineService.instance.WaitForEndOfFrame());

        GameEntity ninjaList    = null;
        GameEntity friendlyList = null;
        GameEntity enemyList    = null;
        var        selfTeam     = 0;

        foreach (var entity in _context.GetEntitiesWithName("ChooseNinjaWindowNinjaList"))
        {
            ninjaList = entity;
            break;
        }
        foreach (var entity in _context.GetEntitiesWithName("ChooseNinjaWindowFriendlyList"))
        {
            friendlyList = entity;
            break;
        }
        foreach (var entity in _context.GetEntitiesWithName("ChooseNinjaWindowEnemyList"))
        {
            enemyList = entity;
            break;
        }

        foreach (var player in _context.currentMatchData.value.matchPlayers)
        {
            if (player.userId != _context.currentPlayerId.value)
            {
                continue;
            }
            selfTeam = player.team;
            break;
        }

        if (ninjaList == null || friendlyList == null || enemyList == null)
        {
            yield break;
        }

        for (var i = 0; i < allocationNinja.ninjaList.Count; i++)
        {
            var ninjaItem = allocationNinja.ninjaList[i];
            var ui        = _context.CreateEntity();
            ui.ReplaceUiOpen("ChooseNinjaItem");
            ui.ReplaceName("ChooseNinjaItem_" + i);
            ui.ReplaceChooseNinjaItemInfo(ninjaItem);
            ui.ReplaceParentEntity(ninjaList);
        }

        for (var i = 0; i < _context.currentMatchData.value.matchPlayers.Count; i++)
        {
            var player = _context.currentMatchData.value.matchPlayers[i];
            var ui     = _context.CreateEntity();
            ui.ReplaceUiOpen("PlayerChooseItem");
            ui.ReplaceName("PlayerChooseItem_" + i);
            ui.ReplacePlayerChooseNinjaInfo(player.userId, "", false);
            ui.ReplaceParentEntity(player.team == selfTeam ? friendlyList : enemyList);
        }

        _context.ReplaceAllocationNinja(allocationNinja);
    }