public void ReplaceCurrentMatchData(SCMatchData newValue)
    {
        var index     = GameComponentsLookup.CurrentMatchData;
        var component = (CurrentMatchDataComponent)CreateComponent(index, typeof(CurrentMatchDataComponent));

        component.value = newValue;
        ReplaceComponent(index, component);
    }
Example #2
0
    public void ReplaceStartReplay(SCMatchData newMatchData)
    {
        var index     = GameComponentsLookup.StartReplay;
        var component = (StartReplayComponent)CreateComponent(index, typeof(StartReplayComponent));

        component.matchData = newMatchData;
        ReplaceComponent(index, component);
    }
    public void ReplaceMatchReplayListItem(int newIndex, SCMatchData newMatchData)
    {
        var index     = GameComponentsLookup.MatchReplayListItem;
        var component = (MatchReplayListItemComponent)CreateComponent(index, typeof(MatchReplayListItemComponent));

        component.index     = newIndex;
        component.matchData = newMatchData;
        ReplaceComponent(index, component);
    }
Example #4
0
    public GameEntity SetStartReplay(SCMatchData newMatchData)
    {
        if (hasStartReplay)
        {
            throw new Entitas.EntitasException("Could not set StartReplay!\n" + this + " already has an entity with StartReplayComponent!",
                                               "You should check if the context already has a startReplayEntity before setting it or use context.ReplaceStartReplay().");
        }
        var entity = CreateEntity();

        entity.AddStartReplay(newMatchData);
        return(entity);
    }
    public GameEntity SetCurrentMatchData(SCMatchData newValue)
    {
        if (hasCurrentMatchData)
        {
            throw new Entitas.EntitasException("Could not set CurrentMatchData!\n" + this + " already has an entity with CurrentMatchDataComponent!",
                                               "You should check if the context already has a currentMatchDataEntity before setting it or use context.ReplaceCurrentMatchData().");
        }
        var entity = CreateEntity();

        entity.AddCurrentMatchData(newValue);
        return(entity);
    }
Example #6
0
    public void ReplaceStartReplay(SCMatchData newMatchData)
    {
        var entity = startReplayEntity;

        if (entity == null)
        {
            entity = SetStartReplay(newMatchData);
        }
        else
        {
            entity.ReplaceStartReplay(newMatchData);
        }
    }
    public void ReplaceCurrentMatchData(SCMatchData newValue)
    {
        var entity = currentMatchDataEntity;

        if (entity == null)
        {
            entity = SetCurrentMatchData(newValue);
        }
        else
        {
            entity.ReplaceCurrentMatchData(newValue);
        }
    }
Example #8
0
    public void OnMatchReplayListItem(GameEntity entity, int index, SCMatchData matchData)
    {
        var itemIndex = transform.Find("MatchReplayListItemIndex").GetComponent <Text>();

        itemIndex.text = $"{index,0:D4}";

        var dataTime      = transform.Find("MatchReplayListItemDateTime").GetComponent <Text>();
        var matchDateTime = _context.timeService.instance.TimeStampToDateTime(matchData.matchStartTime);

        dataTime.text = matchDateTime.ToString("yyyy-MM-dd HH:mm:ss");

        var mapImage = transform.Find("MatchReplayListItemMap/MatchReplayListItemMapImage").GetComponent <Image>();
        var mapText  = transform.Find("MatchReplayListItemMap/MatchReplayListItemMapText").GetComponent <Text>();

        mapText.text    = _context.mapConfig.list[matchData.matchMap.mapName].Name;
        mapImage.sprite = Resources.Load <Sprite>("Image/UI/MapImage/" + matchData.matchMap.mapName);

        var characterText  = transform.Find("MatchReplayListItemCharacter/MatchReplayListItemCharacterText").GetComponent <Text>();
        var characterImage = transform.Find("MatchReplayListItemCharacter/MatchReplayListItemCharacterHeadShot").GetComponent <Image>();

        foreach (var player in matchData.matchPlayers)
        {
            if (player.userId != _context.currentPlayerId.value)
            {
                continue;
            }
            characterText.text    = _context.characterBaseAttributes.dic[player.ninjaName].name;
            characterImage.sprite = Resources.Load <Sprite>("Image/UI/HeadShot/" + player.ninjaName + "HeadShot");
            break;
        }

        var matchSize = transform.Find("MatchReplayListItemMatchSize").GetComponent <Text>();

        switch (matchData.matchSize)
        {
        case 2:
            matchSize.text = "1 VS 1";
            break;

        case 4:
            matchSize.text = "2 VS 2";
            break;

        case 8:
            matchSize.text = "4 VS 4";
            break;

        default:
            matchSize.text = "";
            break;
        }

        var matchType = transform.Find("MatchReplayListItemMatchType").GetComponent <Text>();

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

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

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

        default:
            matchType.text = "未知";
            break;
        }
    }