예제 #1
0
        public void RefreshItem()
        {
            winIcon.gameObject.SetActive(info.matchSide == info.winners);
            failIcon.gameObject.SetActive(info.matchSide != info.winners);

            deathCountText.text  = string.Format("{0}/{1}", info.killQuantity, info.dieQuantity);
            battleModeText.text  = GetBattleMode(info.battleType);
            battleScoreText.text = info.resouce.ToString();
            dateText.text        = GetDateString(info.battleStartDate);

            if (!string.IsNullOrEmpty(info.portrait))
            {
                Resource.GameResourceLoadManager.GetInstance().LoadAtlasSprite(info.portrait, delegate(string name, AtlasSprite atlasSprite, System.Object param) {
                    playerIcon.SetSprite(atlasSprite);
                }, true);
            }

            for (int i = 0; i < unitIconArray.Length; i++)
            {
                if (unitsProtoData.Find(p => p.ID == info.unitId[i]) == null)
                {
                    return;
                }

                int   icon     = unitsProtoData.Find(p => p.ID == info.unitId[i]).Icon;
                Image unitIcon = unitIconArray[i];

                if (icon != 0)
                {
                    Resource.GameResourceLoadManager.GetInstance().LoadAtlasSprite(icon, delegate(string name, AtlasSprite atlasSprite, System.Object param) {
                        unitIcon.SetSprite(atlasSprite);
                    }, true);
                }
            }

            isHaveBattleInfoInLocal = false;
            long[] localBattleid = PlayBackManager.GetInstance().GetBattleIdsFromPlaybackLocalCache();
            for (int i = 0; i < localBattleid.Length; i++)
            {
                if (info.battleId == localBattleid[i])
                {
                    isHaveBattleInfoInLocal = true;
                    break;
                }
            }
            if (isHaveBattleInfoInLocal)
            {
                playBackButton.gameObject.SetActive(true);
            }
            else
            {
                playBackButton.gameObject.SetActive(false);
            }
        }
예제 #2
0
        public void RequsetPlayBackData()
        {
            long battleId = DataManager.GetInstance().GetBattleId();

            DebugUtils.Log(DebugUtils.Type.Playback, string.Format("Request playback data battleId = {0}", battleId));

            //PlaybackC2S message = new PlaybackC2S();
            //message.battleId = battleId;
            //byte[] data = ProtobufUtils.Serialize( message );
            //NetworkManager.SendRequest( ServerType.BattleServer, MsgCode.PlayBackMessage, data );
            PlayBackManager.GetInstance().DownloadPlaybackData(battleId);
        }
예제 #3
0
    public static PlayBackManager GetInstance()
    {
        if (instance == null)
        {
            instance = new PlayBackManager();

            localCacheDirectory = string.Format("{0}/{1}", Application.persistentDataPath, "localCache");

            DebugUtils.Log(DebugUtils.Type.Playback, string.Format("Local cache directory:{0}", localCacheDirectory));
        }

        if (!Directory.Exists(localCacheDirectory))
        {
            Directory.CreateDirectory(localCacheDirectory);

            DebugUtils.Log(DebugUtils.Type.Playback, string.Format("Creat local cache directory:{0}", localCacheDirectory));
        }

        return(instance);
    }
 public void EnterMainMenu()
 {
     PlayBackManager.GetInstance().QuitPlaybattleBack();
 }
예제 #5
0
 private void ClickPlayBackButton()
 {
     //TODO : PlayBack
     PlayBackManager.GetInstance().PlayBattleBack(info.battleId);
 }