Example #1
0
    private void OnMazeGenerationStarted(object sender, MazeGenerationEventArgs mazeGenerationEventArgs)
    {
        Vector3 cameraFocusPoint = ToolMethods.CalculateTransformCenterpoint(new Vector3(mazeGenerationEventArgs.MazeDimensions.x, mazeSpawnPoint.transform.position.y, mazeGenerationEventArgs.MazeDimensions.y));

        cameraFocusPoint = ToolMethods.CalculateFocusPosition(cameraFocusPoint, mazeGenerationEventArgs.MazeDimensions);
        focusCamera.transform.position = cameraFocusPoint;
    }
Example #2
0
        public void GetProbability()
        {
            double[] array = new double[elements.Count];
            int      m     = 0;

            foreach (KeyValuePair <long, double> item in elements)
            {
                array[m] = item.Value;
                m++;
            }

            basicNumber = ToolMethods.GetBaseNumber(array);

            //判断设置的概率
            double allRate = 0;

            foreach (var item in elements)
            {
                allRate += item.Value;
            }

            string temp = allRate.ToString();

            allRate = double.Parse(temp);
            if (allRate.CompareTo(1.0) != 0)
            {
                throw new Exception("概率设置错误,请检查概率数值.");
            }
        }
Example #3
0
        protected override void OnStop()
        {
            _redisMQLog = new RedisMQLog {
                Title = "服务停止", Content = "大方工业云数据同步服务:【服务停止】", CDate = ToolMethods.GetNow()
            };
            WriteLog(_redisMQLog);

            _server.Dispose();
        }
Example #4
0
        protected override void OnStart(string[] args)
        {
            _redisMQLog = new RedisMQLog {
                Title = "服务启动", Content = "大方工业云数据同步服务:【服务启动】", CDate = ToolMethods.GetNow()
            };
            WriteLog(_redisMQLog);

            _server.Start();
        }
Example #5
0
 public void HangfireService()
 {
     try
     {
     }
     catch (Exception ee)
     {
         _redisMQLog = new RedisMQLog {
             Title = "服务状态异常", Content = "【服务异常】:" + ee.ToString(), CDate = ToolMethods.GetNow()
         };
         WriteLog(_redisMQLog);
     }
 }
Example #6
0
        public long GetGiftIndex(ref Random seed)
        {
            long selectedElement = 0;
            long diceRoll        = ToolMethods.GetRandomNumber(seed, 1, basicNumber);
            long cumulative      = 0;

            for (int i = 0; i < elements.Count; i++)
            {
                cumulative += (long)(elements[i].Value * basicNumber);
                if (diceRoll <= cumulative)
                {
                    selectedElement = elements[i].Key;
                    break;
                }
            }
            return(selectedElement);
        }
Example #7
0
    public void SetMazeHeight()
    {
        int inputValue = ToolMethods.SetEvenNumberToOdd(ToolMethods.GetIntValueFromInputField(mazeHeightInputField));

        mazeDimensions = new Vector2Int(mazeDimensions.x, inputValue);
    }
Example #8
0
    //maze value setters for button functions
    public void SetMazeWidth()
    {
        int inputValue = ToolMethods.SetEvenNumberToOdd(ToolMethods.GetIntValueFromInputField(mazeWidthInputField));

        mazeDimensions = new Vector2Int(inputValue, mazeDimensions.y);
    }