Пример #1
0
    public void LevelFinished()
    {
        Player.IsStuck = true;

        Scene activeScene = SceneManager.GetActiveScene();
        int   nbScene     = activeScene.buildIndex - 2; // TODO watch if we modify the build order

        if (LevelManager.UnlockedLevels == nbScene)
        {
            Debug.Log("CurrentScene:" + nbScene);

            int nbScene1 = nbScene + 1;
            LevelManager.SaveData(nbScene1);
        }

        // Invoke to return to main menu
        if (SceneManager.GetActiveScene().buildIndex == 8)
        {
            Invoke("ReturnToMenu", 12);
        }
        else
        {
            Invoke("ReturnToMenu", 6);
        }


        // Handles the movie playing
        int          nbMovie     = nbScene++;
        MovieTexture _movTexture = Resources.Load <MovieTexture>("Movies/Carte_" + nbMovie) as MovieTexture;

        if (SceneManager.GetActiveScene().buildIndex == 8) // END LEVEL
        {
            _movTexture = Resources.Load <MovieTexture>("Movies/ANIMATION FIN") as MovieTexture;
        }

        GameObject.Find("MoviePlayer").GetComponent <MeshRenderer>().enabled          = true;
        GameObject.Find("MoviePlayer").GetComponent <Renderer>().material.mainTexture = _movTexture;

        ((MovieTexture)GameObject.Find("MoviePlayer").GetComponent <Renderer>().material.mainTexture).Play();
        _movTexture.Play();



        // Not necessary since we are not keeping any object between scenes. But if so, we should do this.
        nbDeathInLevel = 0;

        CustomData customData = new CustomData();

        customData.Add("NUMBER_OF_DEATH", nbDeathInLevel.ToString());
        customData.Add("LEVEL_NAME", activeScene.name);
        RedMetricsManager.get().sendEvent(TrackingEvent.DEATH_AVERAGE, customData);
    }
Пример #2
0
 private void SetValues()
 {
     tableName = tableNameTb.Text.Trim();
     CustomData.Add("TableName", TableName);
     CustomData.Add("ObjectId", FeatureIdColumn);
     //Tag = string.Format(CultureInfo.InvariantCulture, "{0}|{1}", TableName, FeatureIdColumn);
 }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Space))
        {
            CustomData customData = new CustomData();
            customData.Add("velocity", this.gameObject.GetComponent <Rigidbody>().velocity.ToString());

            RedMetricsManager.get().sendEvent(TrackingEvent.JUMP,
                                              this.gameObject.transform.position,
                                              customData,
                                              Application.loadedLevelName);

            giveImpulsion();
        }

        if (this.gameObject.transform.localPosition.y < -2.0f)
        {
            CustomData customData = new CustomData();
            customData.Add("velocity", this.gameObject.GetComponent <Rigidbody>().velocity.ToString());

            RedMetricsManager.get().sendEvent(TrackingEvent.BOUNCE,
                                              this.gameObject.transform.position,
                                              customData,
                                              Application.loadedLevelName);
            giveImpulsion();
        }
    }
Пример #4
0
	// Update is called once per frame
	void Update () {
		if(Input.GetKeyUp(KeyCode.Space)) {

			CustomData customData = new CustomData();
			customData.Add("velocity", this.gameObject.GetComponent<Rigidbody>().velocity.ToString());

			RedMetricsManager.get ().sendEvent(TrackingEvent.JUMP,
			                                   this.gameObject.transform.position,
			                                   customData,
			                                   Application.loadedLevelName);

			giveImpulsion();
		}

		if(this.gameObject.transform.localPosition.y < -2.0f) {

			CustomData customData = new CustomData();
			customData.Add("velocity", this.gameObject.GetComponent<Rigidbody>().velocity.ToString());

			RedMetricsManager.get ().sendEvent(TrackingEvent.BOUNCE, 
			                                   this.gameObject.transform.position,
			                                   customData,
			                                   Application.loadedLevelName);
			giveImpulsion();
		}
	}
Пример #5
0
    void Victory()
    {
        EndTime      = Time.time;
        TimeToFinish = EndTime - StartTime;

        //Redmetrics
        if (GameObject.FindGameObjectWithTag("Redmetrics") != null)
        {
            CustomData _customData = new CustomData();
            _customData.Add("Level Finished", "Level " + Application.loadedLevel + " finished, " +
                            "Time Taken to finish : " + (int)TimeToFinish + " seconds, " +
                            "Number of trials : " + NumberOfTries);

            RedMetricsManager.get().sendEvent(TrackingEvent.LEVELFINISHED, _customData);
        }
        //

        _UI.SetActive(false);
        foreach (Transform child in _ParticulSystem.transform)
        {
            child.GetComponent <ParticleSystem>().Play();
        }
        CurrentCase.transform.DOLocalMoveY(10, AscnesionTime);
        StartCoroutine("KatyPerry");
    }
    void Start()
    {
        CustomData customData = new CustomData();

        customData.Add("Level_Name", Application.loadedLevelName);

        RedMetricsManager.get().sendEvent(TrackingEvent.START, customData);
    }
Пример #7
0
    public CustomData generateCustomDataForGuidInit()
    {
        //TODO manage GLOBALPLAYERGUID
        CustomData guidCD = new CustomData(CustomDataTag.LOCALPLAYERGUID, localPlayerGUID);

        guidCD.Add(CustomDataTag.PLATFORM, Application.platform.ToString().ToLowerInvariant());
        //logMessage(MessageLevel.DEFAULT, "generated guidCD={0}", guidCD);
        return(guidCD);
    }
Пример #8
0
        public AuthorizationBuilder WithCustomData(params string[] values)
        {
            if (CustomData == null)
            {
                CustomData = new List <string[]>();
            }
            CustomData.Add(values);

            return(this);
        }
Пример #9
0
    // Use this for initialization
    void Start()
    {
        CustomData customData = new CustomData();

        customData.Add("customKey1", "customValue1");
        customData.Add("customKey2", "customValue2");

        int[] coordinates = { 1, 2, 3 };

        TrackingEventData data = new TrackingEventDataWithoutIDs(
            TrackingEvent.START,
            customData,
            "map1.level1.section1",
            coordinates
            );

        //*
        JsonWriter writer = new JsonWriter();

        writer.PrettyPrint = true;

        JsonMapper.ToJson(data, writer);

        string json = writer.ToString();

        Debug.Log("obj=" + data);
        Debug.Log("serialized=" + json);

        TrackingEventData deserializedData = JsonMapper.ToObject <TrackingEventData>(json);

        /*/
         *
         * // If you don't need a JsonWriter, use this.
         * string json = JsonMapper.ToJson(exampleClass);
         *
         * //*/

        Debug.Log("deserialized:" + deserializedData);
    }
Пример #10
0
    public void Death()
    {
        if (Player.animator.GetBool("isAlive"))
        {
            AudioClip deathClip = Resources.Load <AudioClip>("Music/son/Death");
            GetComponentInChildren <AudioSource>().PlayOneShot(deathClip);

            nbDeathInLevel++;
            transform.localScale = new Vector3(1, 1, 1);
            transform.rotation   = Quaternion.identity;
            Player.IsStuck       = true;
            Player.animator.SetBool("isAlive", false);
            Invoke("DestroyPlayer", 0.5f);

            Vector2 _deathPos = new Vector2((int)Player.transform.position.x, (int)Player.transform.position.y);

            CustomData customData = new CustomData();
            customData.Add("POSITION", Player.transform.position.ToString());
            customData.Add("LEVEL_NAME", SceneManager.GetActiveScene().name);
            RedMetricsManager.get().sendEvent(TrackingEvent.DEATH_POSITION, customData);
        }
    }
Пример #11
0
 /// <summary>
 /// Populates the CustomData collection via <see cref="ExceptionalSettingsBase.GetCustomData"/>, if set.
 /// </summary>
 private void AddCustomData()
 {
     if (Settings.GetCustomData != null)
     {
         InitCustomData();
         try
         {
             Settings.GetCustomData(Exception, CustomData);
         }
         catch (Exception cde)
         {
             // if there was an error getting custom errors, log it so we can display such in the view...and not fail to log the original error
             CustomData.Add(Constants.CustomDataErrorKey, cde.ToString());
         }
     }
 }
Пример #12
0
 /// <summary>
 /// Sets the IPAddress of an error based on the passed-in <see cref="Settings"/>.
 /// </summary>
 /// <returns>The passed-in <see cref="Error"/> for chaining.</returns>
 public void SetIPAddress()
 {
     if (Settings.Current.GetIPAddress != null)
     {
         try
         {
             IPAddress = Settings.Current.GetIPAddress();
         }
         catch (Exception gipe)
         {
             InitCustomData();
             // if there was an error getting the IP, log it so we can display such in the view...and not fail to log the original error
             CustomData.Add(Constants.CustomDataErrorKey, "Fetching IP Address: " + gipe);
         }
     }
 }
Пример #13
0
        /// <summary>
        /// 从一个类获取数据
        /// </summary>
        /// <param name="data"></param>
        public void DataFromDataItem(object data)
        {
            Type type = data.GetType();

            foreach (PropertyInfo pinfo in type.GetProperties(BindingFlags.Instance | BindingFlags.IgnoreCase | BindingFlags.NonPublic | BindingFlags.Public))
            {
                if (CustomData.ContainsKey(pinfo.Name))
                {
                    continue;
                }
                object value = type.InvokeMember(pinfo.Name, BindingFlags.Instance | BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.NonPublic, null, data, null);
                if (value != null)
                {
                    CustomData.Add(pinfo.Name, value);
                }
            }
        }
Пример #14
0
        void addOrOverrideCustomData(Guid g, string name, string value)
        {
            if (!CustomData.ContainsKey(g))
            {
                CustomData.Add(g, new Dictionary <string, string>());
            }

            var dict = CustomData[g];

            if (dict.ContainsKey(name))
            {
                dict[name] = value;
            }
            else
            {
                dict.Add(name, value);
            }
        }
Пример #15
0
        public void Set <T>(string group, string key, T value)
        {
            if (!CustomData.ContainsKey(group))
            {
                CustomData.Add(group, new Dictionary <string, object>());
            }

            Dictionary <string, object> storage = CustomData[group];

            if (storage.ContainsKey(key))
            {
                storage.Add(key, value);
            }
            else
            {
                storage[key] = value;
            }
        }
Пример #16
0
    void Victory()
    {
        EndTime = Time.time;
        TimeToFinish = EndTime - StartTime;

        //Redmetrics
        if (GameObject.FindGameObjectWithTag("Redmetrics") !=null){
        CustomData _customData = new CustomData();
        _customData.Add("Level Finished", "Level " + Application.loadedLevel + " finished, " +
                                    "Time Taken to finish : " + (int)TimeToFinish + " seconds, " +
                                    "Number of trials : " + NumberOfTries);

        RedMetricsManager.get().sendEvent(TrackingEvent.LEVELFINISHED, _customData);
        }
        //

        _UI.SetActive(false);
        foreach (Transform child in _ParticulSystem.transform)
        {
            child.GetComponent<ParticleSystem>().Play();
        }
        CurrentCase.transform.DOLocalMoveY(10, AscnesionTime);
        StartCoroutine("KatyPerry");
    }
Пример #17
0
    void Update()
    {
        #region Tout ceci est pour les warehouses et leurs effets
        //Tout ceci est pour les warehouses et leurs effets
        for (var i = _numberOfWarehouses.Count - 1; i > -1; i--) {
            if (_numberOfWarehouses [i] == null)
                _numberOfWarehouses.RemoveAt (i);
        }

        _intOfWarehouses = _numberOfWarehouses.Count;

        _maxElectricity = 500f + (500f / 20) * _intOfWarehouses;
        _maxOxygen = 300f + (300f / 20) * _intOfWarehouses;
        _maxWater = 300f + (300f / 20) * _intOfWarehouses;
        _maxFood = 300f + (300f / 20) * _intOfWarehouses;
        _maxConstructionMaterials = 2000f + (1000f / 20) * _intOfWarehouses;
        _maxReparationMaterials = 2000f + (1000f / 20) * _intOfWarehouses;
        _maxUpgradeMaterials = 2000f + (1000f / 20) * _intOfWarehouses;
        #endregion

        //Redmetrics When the night end send stats
        if (Camera.main.GetComponent<DayNightController> ().currentTimeOfDay == 0) {

            CustomData customData = new CustomData ();
            customData.Add ("DataDay", ",  Oxygen: " + _actualOxygen + ",  Water: " + _actualWater + ",  Food: " + _actualFood + ",  Electricity: " + _actualElectricity + ",  Days: " + Camera.main.GetComponent<DayNightController> ()._days);

            RedMetricsManager.get ().sendEvent (TrackingEvent.STATS, customData);
        }
        //Redmetrics When the night end send stats

        if (_actualElectricity > _maxElectricity) {
            _actualElectricity = _maxElectricity;
        }

        if (_actualFood > _maxFood) {
            _actualFood = _maxFood;
        }

        if (_actualHumans > _maxHumans) {
            _actualHumans = _maxHumans;
        }

        if (_actualOxygen > _maxOxygen) {
            _actualOxygen = _maxOxygen;
        }

        if (_actualWater > _maxWater) {
            _actualWater = _maxWater;
        }

        if (_actualTemperature > _maxTemperature) {
            _actualTemperature = _maxTemperature;
        }

        if (_actualConstructionMaterials > _maxConstructionMaterials) {
            _actualConstructionMaterials = _maxConstructionMaterials;
        }

        if (_actualReparationMaterials > _maxReparationMaterials) {
            _actualReparationMaterials = _maxReparationMaterials;
        }

        if (_actualUpgradeMaterials > _maxUpgradeMaterials) {
            _actualUpgradeMaterials = _maxUpgradeMaterials;
        }
    }
Пример #18
0
 public LogInfo AddCustomData(string key, string value)
 {
     CustomData.Add(key, value);
     return(this);
 }
Пример #19
0
 public CustomData generateCustomDataForGuidInit() {
     //TODO manage GLOBALPLAYERGUID
     CustomData guidCD = new CustomData (CustomDataTag.LOCALPLAYERGUID, localPlayerGUID);
     guidCD.Add(CustomDataTag.PLATFORM, Application.platform.ToString().ToLowerInvariant());
     //logMessage(MessageLevel.DEFAULT, "generated guidCD={0}", guidCD);
     return guidCD;        
 } 
Пример #20
0
 public void AddCustomDataItem(object customDataItem)
 {
     CustomData.Add((CustomDataItem)customDataItem);
 }