public IContentPack Load(string path)
        {
            ContentPackInfo info    = new ContentPackInfo();
            Texture2D       texture = new Texture2D(2, 2);

            try
            {
                JToken data = DataSerialization.FromFile(Path.Combine(path, ABOUT_FILE));
                info = ObjectPipeline.BuildObject <ContentPackInfo>(data);

                if (File.Exists(Path.Combine(path, IMAGE_FILE)))
                {
                    texture.LoadImage(File.ReadAllBytes(Path.Combine(path, IMAGE_FILE)));
                    texture.filterMode = FilterMode.Point; // TODO: Allow content packs to decide this individually.
                }
                else
                {
                    texture = null;
                }
            }
            catch (FileNotFoundException)
            {
                info.Name        = Path.GetFileName(path);
                info.Author      = "Unknown Author";
                info.Version     = "Unknown Version";
                info.Description = "Unknown Description";

                File.WriteAllText(Path.Combine(path, ABOUT_FILE), ObjectPipeline.UnbuildObject(info, true).ToString());
            }

            return(new ContentPack(path + "/", info.Name, info.Author, info.Description, info.Version, texture));
        }
示例#2
0
        public static SolveRequestMessage loadDataFromDisc(String filePath)
        {
            SolveRequestMessage solveRequestMessage;
            StreamReader        streamReader = new StreamReader(filePath);
            string    text      = streamReader.ReadToEnd();
            VRPParser benchmark = new VRPParser(text);

            string problemType = "";

            byte[] data;
            streamReader.Close();

            String extension = Path.GetExtension(filePath);

            if (extension == ".vrp")
            {
                problemType = "DVRP";
            }
            else
            {
                Console.WriteLine(">> Unsupported problem type. Please load a problem with one of the following problem types: \n *DVRP");
                return(null);
            }

            data = DataSerialization.ObjectToByteArray(benchmark);
            //    data = GetBytes(filePath);
            solveRequestMessage = new SolveRequestMessage(problemType, data);
            Console.WriteLine(" >> Success");
            return(solveRequestMessage);
        }
 private void Awake()
 {
     if (!DataSerialization.fileExists(Application.persistentDataPath + "/firstTimePlayer.txt"))
     {
         DataSerialization.SaveData(true, "firstTimePlayer");
         DataSerialization.SaveData(0, "gold");
         DataSerialization.SaveData("PLAYER__NAME", "name");
         DataSerialization.SaveData(0, "money");
         DataSerialization.SaveData(0, "xp");
         DataSerialization.SaveData(1, "LV");
         DataSerialization.SaveData(1, "lastOpenedLevel");
         DataSerialization.SaveData(1.0f, "postProcessingValue");
         DataSerialization.SaveData(false, "IsThisLastOpenedLevel");
         DataSerialization.SaveData(1.0f, "sound");
         DataSerialization.SaveData(1.0f, "music");
         DataSerialization.SaveData(false, "playerCurrentLevel");
         DataSerialization.SaveData(0, "selectedLevel");
         List <BulletData> openedBullets = new List <BulletData>();
         openedBullets.Add(new BulletData("default bullet", 3));
         DataSerialization.SaveData(openedBullets, "openedBullets");
         List <BulletData> selectedBullets = new List <BulletData>();
         selectedBullets.Add(new BulletData("default bullet", 2));
         DataSerialization.SaveData(selectedBullets, "selectedBullets");
         DataSerialization.SaveData("Touche", "ControlMode");
         ControlModePanel.SetActive(true);
     }
     setUpSettingPanelValues();
 }
示例#4
0
    public static void SaveWorldMap(WorldMapData worldMapData)
    {
        FileStream      fs = File.Create(WorldMapSaveFile);
        BinaryFormatter bf = new BinaryFormatter();

        SerializedWorldMapData gameData = new SerializedWorldMapData();

        gameData.Player = DataSerialization.Serialize(worldMapData.Player);

        gameData.Seed          = worldMapData.Seed;
        gameData.WorldMapInfos = worldMapData.WorldMapInfos;
        gameData.DiscoveredMap = worldMapData.DiscoveredMap;
        gameData.CurrentPosX   = (int)worldMapData.CurrentPos.x;
        gameData.CurrentPosY   = (int)worldMapData.CurrentPos.y;
        gameData.Size          = worldMapData.Size;

        gameData.InventoryItemId       = new List <string>();
        gameData.InventoryItemQuantity = new List <int>();
        foreach (Item item in worldMapData.Inventory)
        {
            gameData.InventoryItemId.Add(item.ItemId.ToString());
            gameData.InventoryItemQuantity.Add(item.Quantity);
        }

        bf.Serialize(fs, gameData);
        fs.Close();
    }
示例#5
0
        private static object GetDataObject <T>(this CloudEvent cloudEvent, DataSerialization serialization)
            where T : class
        {
            return(_dataObjects.GetValue(cloudEvent, evt =>
            {
                var stringData = evt.StringData;

                if (string.IsNullOrEmpty(stringData))
                {
                    if (evt.BinaryData != null)
                    {
                        stringData = Encoding.UTF8.GetString(evt.BinaryData);
                    }

                    if (string.IsNullOrEmpty(stringData))
                    {
                        return null;
                    }
                }

                return serialization == DataSerialization.Json
                    ? JsonDeserialize <T>(stringData)
                    : XmlDeserialize <T>(stringData);
            }));
        }
    public static void QueueItemToSave(GameObject saveObject, string serializedGuid)
    {
        SerializableData serializableData = new SerializableData();

        #region Serilaize Object
        #region Serialize Unity classes and types
        serializableData.ID = DataSerialization.Serialize(serializedGuid);
        serializableData.activeInHierarchy = DataSerialization.Serialize(saveObject.activeInHierarchy);
        serializableData.unitySerializableData.sTransform = DataSerialization.Serialize(saveObject.transform.Serialize());
        serializableData.unitySerializableData.sCamera    = (saveObject.GetComponent <Camera>() is var cam && cam != null) ?                                                     DataSerialization.Serialize(cam.Serialize()) : null;

        #region Audio
        serializableData.unitySerializableData.sAudioChorusFilter     = (saveObject.GetComponent <AudioChorusFilter>() is var audioChorusFilter && audioChorusFilter != null) ?              DataSerialization.Serialize(audioChorusFilter.Serialize()) : null;
        serializableData.unitySerializableData.sAudioDistortionFilter = (saveObject.GetComponent <AudioDistortionFilter>() is var audioDistortionFilter && audioDistortionFilter != null) ?  DataSerialization.Serialize(audioDistortionFilter.Serialize()) : null;
        serializableData.unitySerializableData.sAudioEchoFilter       = (saveObject.GetComponent <AudioEchoFilter>() is var audioEchoFilter && audioEchoFilter != null) ?                    DataSerialization.Serialize(audioEchoFilter.Serialize()) : null;
        serializableData.unitySerializableData.sAudioHighPassFilter   = (saveObject.GetComponent <AudioHighPassFilter>() is var audioHighPassFilter && audioHighPassFilter != null) ?        DataSerialization.Serialize(audioHighPassFilter.Serialize()) : null;
        serializableData.unitySerializableData.sAudioListener         = (saveObject.GetComponent <AudioListener>() is var audioListener && audioListener != null) ?                          DataSerialization.Serialize(audioListener.Serialize()) : null;
        serializableData.unitySerializableData.sAudioLowPassFilter    = (saveObject.GetComponent <AudioLowPassFilter>() is var audioLowPassFilter && audioLowPassFilter != null) ?           DataSerialization.Serialize(audioLowPassFilter.Serialize()) : null;
        serializableData.unitySerializableData.sAudioReverbFilter     = (saveObject.GetComponent <AudioReverbFilter>() is var audioReverbFilter && audioReverbFilter != null) ?              DataSerialization.Serialize(audioReverbFilter.Serialize()) : null;
        serializableData.unitySerializableData.sAudioReverbZone       = (saveObject.GetComponent <AudioReverbZone>() is var audioReverbZone && audioReverbZone != null) ?                    DataSerialization.Serialize(audioReverbZone.Serialize()) : null;
        serializableData.unitySerializableData.sAudioSource           = (saveObject.GetComponent <AudioSource>() is var audioSource && audioSource != null) ?                                DataSerialization.Serialize(audioSource.Serialize()) : null;
        #endregion

        #region Effects
        serializableData.unitySerializableData.sLensFlare      = (saveObject.GetComponent <LensFlare>() is var lensFlare && lensFlare != null) ?                                      DataSerialization.Serialize(lensFlare.Serialize()) : null;
        serializableData.unitySerializableData.sLineRenderer   = (saveObject.GetComponent <LineRenderer>() is var lineRenderer && lineRenderer != null) ?                             DataSerialization.Serialize(lineRenderer.Serialize()) : null;
        serializableData.unitySerializableData.sParticleSystem = (saveObject.GetComponent <ParticleSystem>() is var particleSystem && particleSystem != null) ?                       DataSerialization.Serialize(particleSystem.Serialize()) : null;
        serializableData.unitySerializableData.sProjector      = (saveObject.GetComponent <Projector>() is var projector && projector != null) ?                                      DataSerialization.Serialize(projector.Serialize()) : null;
        serializableData.unitySerializableData.sTrailRenderer  = (saveObject.GetComponent <TrailRenderer>() is var trailRenderer && trailRenderer != null) ?                          DataSerialization.Serialize(trailRenderer.Serialize()) : null;
        #endregion
        #endregion

        #region Serialize User Defined Classes
        MonoBehaviour[] saveableScripts = saveObject.GetComponents <MonoBehaviour>();

        foreach (var monoItem in saveableScripts)
        {
            if (monoItem is IUniversalSerializedPersistenceSystem == false)
            {
                continue;
            }

            System.Type thisType   = monoItem.GetType();
            MethodInfo  theMethod  = thisType.GetMethod("Serialize");
            object[]    parameters = new object[1] {
                saveObject
            };
            serializableData.serializedScripts = (List <UserDefinedData>)theMethod.Invoke(monoItem, parameters);
            break;
        }
        #endregion
        #endregion

        #region Serilaize Objects Children
        QueueAllChildren(serializedGuid, saveObject.transform, saveObject.transform, ref serializableData);
        #endregion

        UniversalSerializedPersistenceSystem.serializableDataSet.data.Add(serializableData);
        saveObject.BroadcastMessage("SaveMessage", SendMessageOptions.DontRequireReceiver);
    }
    public void NextLevel(string levelSelectingSceneName)
    {
        int selectedLevelIndex = (int)DataSerialization.GetObject("selectedLevel");

        DataSerialization.SaveData(selectedLevelIndex + 1, "selectedLevel");
        SceneManager.LoadScene(levelSelectingSceneName);
    }
示例#8
0
 public void OnEndLevel()
 {
     if (done)
     {
         return;
     }
     finalScore = castle_Manager.damagePercentage;
     if (finalScore >= 50 && !isMultiplayer && !loseMethodUsed)
     {
         if ((int)DataSerialization.GetObject("selectedLevel") + 1 == (int)DataSerialization.GetObject("lastOpenedLevel"))
         {
             DataSerialization.SaveData((int)DataSerialization.GetObject("lastOpenedLevel") + 1, "lastOpenedLevel");
         }
         loseOrWin.text = "Win";
     }
     else
     {
         if (!isMultiplayer)
         {
             loseOrWin.text = "Lose";
         }
     }
     DataSerialization.SaveData((int)DataSerialization.GetObject("xp") + damage_ScoreUI_Mannager.score, "xp");
     if (!isMultiplayer)
     {
         done = true;
         onEndLevel.Invoke();
     }
     else
     {
         oneVoneVarManager.OneVoneVarManager.localGameDone = true;
         oneVoneVarManager.OneVoneVarManager.myTotalXP     = damage_ScoreUI_Mannager.score;
         oneVoneVarManager.OneVoneVarManager.myTotalDamage = damage_ScoreUI_Mannager.castle_Manager.damagePercentage;
     }
 }
示例#9
0
        public object Load(string path, Type type)
        {
            var data  = DataSerialization.FromFile(path);
            var model = ObjectPipeline.DeserializeObject(data);

            return(new ContentCachedTurretAssemblyPrefab(model));
        }
示例#10
0
        /// <summary>
        /// Gets the data (payload) of the <see cref="CloudEvent"/> as type <typeparamref name=
        /// "T"/>.
        /// <para>
        /// This method, along with the <see cref="GetData"/> method, is <em>idempotent</em>. In
        /// other words, every call to either of these methods with <em>same instance</em> of <see
        /// cref="CloudEvent"/> and the <em>same type</em> <typeparamref name="T"/> will return the
        /// <em>same instance</em> of type <typeparamref name="T"/>.
        /// </para>
        /// <para>
        /// If the data object of this cloud event was set using the <see cref=
        /// "SetData{TCloudEvent, T}(TCloudEvent, T, DataSerialization)"/> method, then the same
        /// instance of <typeparamref name="T"/> that was passed to that method will be returned by
        /// this method. Otherwise, the value of <see cref="CloudEvent.StringData"/> is used to
        /// deserialize the instance of <typeparamref name="T"/>.
        /// </para>
        /// </summary>
        /// <typeparam name="T">The type of the <see cref="CloudEvent"/> data.</typeparam>
        /// <param name="cloudEvent">The <see cref="CloudEvent"/> to get data from.</param>
        /// <param name="data">
        /// When this method returns, the data of the <paramref name="cloudEvent"/> if it exists
        /// as (or can be serialized to) type <typeparamref name="T"/>; otherwise, <see langword=
        /// "null"/>. This parameter is passed uninitialized.
        /// </param>
        /// <param name="serialization">
        /// If <paramref name="cloudEvent"/> does not already has a data object associated with it,
        /// the kind of serialization that will be used to convert its <see cref=
        /// "CloudEvent.StringData"/> to type <typeparamref name="T"/>.
        /// </param>
        /// <returns>
        /// <see langword="true"/> if the data of the <paramref name="cloudEvent"/> exists as (or
        /// can be serialized to) type <typeparamref name="T"/>; otherwise <see langword="false"/>.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="cloudEvent"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// If <paramref name="serialization"/> is not defined.
        /// </exception>
        public static bool TryGetData <T>(this CloudEvent cloudEvent, out T data,
                                          DataSerialization serialization = DataSerialization.Json)
            where T : class
        {
            if (cloudEvent is null)
            {
                throw new ArgumentNullException(nameof(cloudEvent));
            }
            if (!Enum.IsDefined(typeof(DataSerialization), serialization))
            {
                throw new ArgumentOutOfRangeException(nameof(serialization));
            }

            try
            {
                var dataObject = cloudEvent.GetDataObject <T>(serialization);

                if (dataObject is T)
                {
                    data = (T)dataObject;
                    return(true);
                }
            }
            catch { }

            data = default;
            return(false);
        }
 private void Start()
 {
     if (DataSerialization.GetObject("ControlMode") as string == "Touche")
     {
         mobileButtonsParent.SetActive(true);
     }
 }
示例#12
0
 private void Update()
 {
     if (canStart)
     {
         for (int i = 0; i < NEEDED_XP_FOREACH_LEVEL.Count; i++)
         {
             if ((int)DataSerialization.GetObject("xp") >= NEEDED_XP_FOREACH_LEVEL[i])
             {
                 currentXP_Level = i + 1;
             }
             else
             {
                 break;
             }
         }
         if (NEEDED_XP_FOREACH_LEVEL.Count - 1 == currentXP_Level)
         {
             currentXPText.text           = "";
             neededXPToNextLevelText.text = "";
         }
         else
         {
             currentXPText.text           = ((int)DataSerialization.GetObject("xp")).ToString() + "xp /";
             neededXPToNextLevelText.text = NEEDED_XP_FOREACH_LEVEL[currentXP_Level].ToString() + "xp";
         }
         DataSerialization.SaveData(currentXP_Level, "LV");
     }
     canStart = false;
 }
        public override byte[] Solve(byte[] partialData, TimeSpan timeout)
        {
            /****************** DESERIALIZE ************************/

            BinaryFormatter formatter = new BinaryFormatter();
            VRPParser       dvrpData  = (VRPParser)formatter.Deserialize(new MemoryStream(partialData));

            /******************* SOLVE *************************/
            float  cutOff  = CUT_OFF_COEFF * (float )dvrpData.Depot_Time_Window[0][1];
            Result results = TSPTrianIneq.calculate(dvrpData, cutOff);

            results.ID = dvrpData.ID;

            for (int i = dvrpData.Num_Depots; i < results.route.Length - dvrpData.Num_Depots; i++)
            {
                results.route[i] = dvrpData.Visit_Location[results.route[i] - dvrpData.Num_Depots] + dvrpData.Num_Depots;
            }

            for (int i = 0; i < results.nextDay.Count; i++)
            {
                results.nextDay[i] = dvrpData.Visit_Location[results.nextDay[i] - dvrpData.Num_Depots] + dvrpData.Num_Depots;
            }

            byte[] data = DataSerialization.ObjectToByteArray(results);

            return(data);
        }
        public static void BroadcastEmojiTexture(this Multiplayer multiplayer, Texture2D texture, int numberEmojis)
        {
            if (Game1.IsMultiplayer)
            {
                object[] objArray = new object[3] {
                    Message.Action.BroadcastEmojiTexture.ToString(),
                         numberEmojis,
                         DataSerialization.Serialize(new TextureData(texture))
                };
                OutgoingMessage message = new OutgoingMessage(Message.TypeID, Game1.player, objArray);

                if (Game1.IsClient)
                {
                    Game1.client.sendMessage(message);
                }
                else if (Game1.IsClient)
                {
                    foreach (Farmer farmer in Game1.getAllFarmers())
                    {
                        if (farmer != Game1.player)
                        {
                            Game1.server.sendMessage(farmer.UniqueMultiplayerID, message);
                        }
                    }
                }
            }
        }
 private void Update()
 {
     lastOpenedLevel = (int)DataSerialization.GetObject("lastOpenedLevel");
     if (lastOpenedLevel > levels.Count)
     {
         lastOpenedLevel = levels.Count;
     }
     //refresh the opened levels list
     openedLevels = new List <LevelObject>();
     for (int i = 0; i < lastOpenedLevel; i++)
     {
         openedLevels.Add(levels[i]);
     }
     if (targetLevelIndex < 0)
     {
         targetLevelIndex = openedLevels.Count - 1;
     }
     else if (targetLevelIndex > openedLevels.Count - 1)
     {
         targetLevelIndex = 0;
     }
     DataSerialization.SaveData(targetLevelIndex, "selectedLevel");
     levelDisplayUIManager.targetLevelObject = levels[targetLevelIndex];
     levelSelectingUIManager.targetScene     = levels[targetLevelIndex].sceneName;
 }
示例#16
0
 public void AddDeserializedArticles(string[] serializedArticles)
 {
     foreach (var item in serializedArticles)
     {
         Articles.Add((Article)DataSerialization.Deserialize(item, typeof(Article)));
     }
 }
        public object Load(string path, Type type)
        {
            JToken data       = DataSerialization.FromFile(path);
            var    serializer = new RootSerializer();
            var    model      = serializer.Deserialize(data);

            return(new ContentCachedPrefab(model));
        }
示例#18
0
 public override void PreInitialize()
 {
     reminders = DataSerialization.DeserializeData <Dictionary <ulong, Reminder> >(path);
     if (reminders == null)
     {
         reminders = new Dictionary <ulong, Reminder>();
     }
 }
示例#19
0
 public void SelectMe()
 {
     DataSerialization.SaveData(MyControlMode, "ControlMode");
     UpdateData();
     foreach (ControlModeButtonManager manager in otherButtonManagers)
     {
         manager.UpdateData();
     }
 }
示例#20
0
 // Use this for initialization
 void Start()
 {
     ParameterSetting    = GameObject.Find("ParameterSetting");
     AutoTacticRender    = GameObject.Find("AutoTacticRender");
     TacticRenderHandlar = GameObject.Find("AutoTacticRender").GetComponent <AutoTacticRenderHandler>();
     GeneticAlgorithm    = GameObject.Find("GeneticAlgorithmSetting").GetComponent <GeneticAlgorithmSetting>();
     GeneticAlgorithmSettingGameObject = GameObject.Find("GeneticAlgorithmSettingGameObject").GetComponent <GeneticAlgorithmSettingGameObject>();
     ParticleSwarmOptimization         = GameObject.Find("ParticleSwarmOptimizationSetting").GetComponent <ParticleSwarmOptimizationSetting>();
     DataSerialization = GameObject.Find("OutputData").GetComponent <DataSerialization>() ?? GameObject.Find("OutputData").AddComponent <DataSerialization>();
 }
示例#21
0
        public string[] SerializeArticles()
        {
            var serializedArticles = new string[Articles.Count];

            for (int i = 0; i < Articles.Count; i++)
            {
                serializedArticles[i] = DataSerialization.Serialize(Articles[i]);
            }
            return(serializedArticles);
        }
    private void Update()
    {
        try{
            //if the game doesn't start yet
            if (gameStarted == false)
            {
                //we check if we can start the game if all the maps are saved
                if (isServer && castleSentFromHostToClient && castleSentFromClientToHost)
                {
                    MapStarter.mapStarter.SetUpMap();
                    oneVoneVarManager.OneVoneVarManager.mapEditor.SetActive(false);
                    oneVoneVarManager.OneVoneVarManager.gameplayWindowObject.SetActive(true);
                    RpcStartGameOnClient();
                    gameStarted = true;
                }

                //if the user pressed space and his map is not saved we save the map
                if (Input.GetKeyDown(KeyCode.Space) && !mapSaved)
                {
                    oneVoneVarManager.OneVoneVarManager.WaitingPanel.SetActive(true);
                    SaveCastle(oneVoneVarManager.OneVoneVarManager.myCastle);
                    if (isServer)
                    {
                        castleSentFromHostToClient = true;
                    }
                    mapSaved = true;
                }
            }
            //check if the local gameIsDone
            if (localGameDone == false)
            {
                if (oneVoneVarManager.OneVoneVarManager.localGameDone)
                {
                    if (isServer)
                    {
                        localGameDone = true;
                    }
                    else
                    {
                        CmdGameDoneOnClientOnly();
                    }
                }
            }
            if (clientGameDone && localGameDone)
            {
                oneVoneVarManager.OneVoneVarManager.gameDone = true;
                RpcGameDone(oneVoneVarManager.OneVoneVarManager.myTotalDamage,
                            oneVoneVarManager.OneVoneVarManager.myTotalXP, (string)DataSerialization.GetObject("name"));
            }
        }catch (Exception e) {
            oneVoneVarManager.OneVoneVarManager.errorPanel.SetActive(true);
            oneVoneVarManager.OneVoneVarManager.errorContent.text = e.ToString();
        }
    }
示例#23
0
 /// <summary>
 /// 全同步
 /// 采用sql方式更新数据库,速度较慢
 /// </summary>
 /// <param name="buyerId"></param>
 private void AllSyncData1(LogedInUser CurrentUser)
 {
     try
     {
         DataSet ds = DataSerialization.UnSerializeData(ProxyFactory.SyncDataProxy.GetSyncData(CurrentUser));
         AllSync1(ds);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public static void ReceiveEmojiTextureBroadcast(this Multiplayer multiplayer, IncomingMessage msg)
 {
     if (Game1.IsMultiplayer && msg.Data.Length > 0)
     {
         ReceivedEmojiTextureEventArgs args = new ReceivedEmojiTextureEventArgs {
             SourceFarmer = msg.SourceFarmer,
             NumberEmojis = msg.Reader.ReadInt32(),
             EmojiTexture = DataSerialization.Deserialize <TextureData>(msg.Reader.BaseStream).GetTexture()
         };
         OnReceiveEmojiTexture(null, args);
     }
 }
示例#25
0
 public void Play()
 {
     if (levelSelectingSceneManager.targetLevelIndex == levelSelectingSceneManager.lastOpenedLevel)
     {
         DataSerialization.SaveData(true, "IsThisLastOpenedLevel");
     }
     else
     {
         DataSerialization.SaveData(false, "IsThisLastOpenedLevel");
     }
     SceneManager.LoadScene(targetScene);
 }
示例#26
0
    private string GetUserJ()
    {
        var user = new Usererialization()
        {
            login = userData.Login, gold = userData.Gold, ram = userData.Ram,
        };
        var data = new DataSerialization()
        {
            user = user, decks = GetListDeck()
        };

        return(JsonConvert.SerializeObject(data));
    }
示例#27
0
    public void UpdateData()
    {
        string controlMode = DataSerialization.GetObject("ControlMode") as string;

        if (controlMode.Equals(MyControlMode))
        {
            GetComponent <Image>().sprite = isSelectedImage;
        }
        else
        {
            GetComponent <Image>().sprite = notSelectedImage;
        }
    }
 void RpcGameDone(int damage, int xp, string playerName)
 {
     if (isServer)
     {
         return;
     }
     oneVoneVarManager.OneVoneVarManager.otherPlayerDamage = damage;
     oneVoneVarManager.OneVoneVarManager.otherPlayerScore  = xp;
     oneVoneVarManager.OneVoneVarManager.otherPlayerName   = playerName;
     CmdSendResultsToHost(oneVoneVarManager.OneVoneVarManager.myTotalDamage,
                          oneVoneVarManager.OneVoneVarManager.myTotalXP, (string)DataSerialization.GetObject("name"));
     oneVoneVarManager.OneVoneVarManager.gameDone = true;
 }
示例#29
0
 public void UpdateSoundsVolume()
 {
     foreach (Sound sound in sounds)
     {
         if (sound.name == "music")
         {
             sound.source.volume = sound.volume * (float)DataSerialization.GetObject("music");
         }
         else
         {
             sound.source.volume = sound.volume * (float)DataSerialization.GetObject("sound");
         }
     }
 }
 public override void LessShootingDistance(float value)
 {
     controlMode         = DataSerialization.GetObject("ControlMode") as string;
     VelocityMultiplyer -= value;
     if (VelocityMultiplyer > 1f)
     {
         VelocityMultiplyer = 1f;
     }
     else if (VelocityMultiplyer < 0f)
     {
         VelocityMultiplyer = 0f;
     }
     finalVelocity = (bullet.velocity + cannonShooter.velocityBoost) * VelocityMultiplyer;
 }
示例#31
0
 internal Parameter ExportArgument(DataSerialization.Argument argument, Action<TraceMessage> traceEvent)
 {
     XmlQualifiedName _dataType = ExportBrowseName(argument.DataType.Identifier, DataTypeIds.BaseDataType, traceEvent);
       return m_AddressSpaceContext.ExportArgument(argument, _dataType, traceEvent);
 }
示例#32
0
 internal Parameter ExportArgument(DataSerialization.Argument argument, XmlQualifiedName dataType, Action<TraceMessage> traceEvent)
 {
     InformationModelFactory.Argument _ret = new InformationModelFactory.Argument()
       {
     DataType = dataType,
     Identifier = new Nullable<int>(),
     Name = argument.Name,
     ValueRank = argument.ValueRank.GetValueRank(traceEvent)
       };
       if (argument.Description != null)
     _ret.AddDescription(argument.Description.Locale, argument.Description.Text);
       return _ret;
 }