private void UpdatePreview()
    {
        if (MouseInputUIBlocker.BlockedByUI)
        {
            return;
        }
        RemoveCopyPoints();
        lastpos = Highlight.pos;
        if (Highlight.pos.x == -1)
        {
            return;
        }

        foreach (var mrk in CopyClipboard)
        {
            if (Consts.IsWithinMapBounds(Highlight.pos + mrk))
            {
                Vector3 pos = Highlight.pos + mrk;
                // height of preview depends on pasting mode
                if (pastingMode == PastingMode.fixed_height)
                {
                    pos.Set(pos.x, fixed_height + mrk.y, pos.z);
                }

                GameObject znacznik = Consts.CreateMarking(seethrough, pos, false);
                Markings.Add(znacznik);
            }
        }
    }
        protected void UpdateMenuItems()
        {
            _menuItems.Clear();
            List <SystemStateItem> shutdownItems = _settings.Settings.ShutdownItemList;

            if (shutdownItems != null)
            {
                bool            timerActive = false;
                SleepTimerModel stm         = ServiceRegistration.Get <IWorkflowManager>().GetModel(Consts.WF_STATE_ID_SLEEP_TIMER_MODEL) as SleepTimerModel;
                if (stm != null && stm.IsSleepTimerActive)
                {
                    timerActive = true;
                }

                foreach (SystemStateItem shutdownItem in shutdownItems)
                {
                    if (!shutdownItem.Enabled)
                    {
                        continue;
                    }
                    ListItem item = new ListItem(Consts.KEY_NAME, Consts.GetResourceIdentifierForMenuItem(shutdownItem.Action, timerActive));
                    item.AdditionalProperties[KEY_SHUTDOWN_ACTION] = shutdownItem.Action;
                    item.Command = new MethodDelegateCommand(() => SelectItem(item));
                    _menuItems.Add(item);
                }
            }
            _menuItems.FireChange();
        }
    /// <summary>
    /// Recover terrain before "matching" terrain up. Tile whom terrain is recovered has to be already destroyed!
    /// </summary>
    static void RecoverTerrain(HashSet <int> indexes)
    {
        if (indexes == null || indexes.Count == 0)
        {
            return;
        }
        List <int> indexes_to_remove = new List <int>();

        foreach (var index in indexes)
        {
            Vector3 v = Consts.IndexToPos(index);
            if (v.x % 4 == 0 && v.z % 4 == 0)
            {
                continue;
            }
            v.y = Consts.MAX_H;
            var trafs = Physics.SphereCastAll(v, 0.005f, Vector3.down, Consts.RAY_H, 1 << 9);
            if (trafs.Count() >= 2)
            {
                indexes_to_remove.Add(index);
                //Consts.former_heights[indexes[i]] = hit.point.y;
            }
        }
        //foreach (var index_to_remove in indexes_to_remove)
        //	indexes.Remove(index_to_remove);

        Consts.UpdateMapColliders(indexes, true);
    }
        protected void UpdateShutdownItems()
        {
            ISettingsManager       sm = ServiceRegistration.Get <ISettingsManager>();
            List <SystemStateItem> systemStateItems = sm.Load <SystemStateDialogSettings>().ShutdownItemList;

            bool timerActive = false;

            Models.SleepTimerModel stm = ServiceRegistration.Get <IWorkflowManager>().GetModel(Consts.WF_STATE_ID_SLEEP_TIMER_MODEL) as Models.SleepTimerModel;
            if (stm != null && stm.IsSleepTimerActive == true)
            {
                timerActive = true;
            }

            _shutdownItems.Clear();
            if (systemStateItems != null)
            {
                for (int i = 0; i < systemStateItems.Count; i++)
                {
                    SystemStateItem systemStateItem = systemStateItems[i];
                    if (!systemStateItem.Enabled)
                    {
                        continue;
                    }
                    ListItem item = new ListItem(Consts.KEY_NAME, Consts.GetResourceIdentifierForMenuItem(systemStateItem.Action, timerActive));
                    item.Command = new MethodDelegateCommand(() => DoAction(systemStateItem.Action));
                    _shutdownItems.Add(item);
                }
            }
            _shutdownItems.FireChange();
        }
Example #5
0
        public double DraftingCoefficient(SimCycling.State.RaceState state)
        {
            double  result         = 1.0;
            Vector3 riderCarVector = state.CarVelocities[0];

            riderCarVector = Vector3.Normalize(riderCarVector);
            Vector3 riderFrontPosition = state.CarPositions[0] + Vector3.Multiply(0.5f * riderLength, riderCarVector);

            for (int i = 1; i < state.CarPositions.Count; i++)
            {
                Vector3 carVector = state.CarVelocities[i];
                if (Consts.Norm(carVector) != 0)
                {
                    carVector = Vector3.Normalize(carVector);
                }

                Vector3 sideVector       = new Vector3(-carVector.Z, 0, carVector.X);
                Vector3 relativePosition = state.CarPositions[i] - Vector3.Multiply(0.5f * riderLength, carVector) - riderFrontPosition;
                result = result * (1 - SingleRiderDraftingReduction(carVector, sideVector, relativePosition, state.CarVelocities[i]));
            }
            // Console.WriteLine("result = {0}", result);
            if (result < 1 - maxReduction)
            {
                result = 1 - maxReduction;
            }
            return(result);
        }
    /// <summary>
    /// Places given tiles again onto terrain. (This function usually runs after changing terrain)
    /// </summary>
    public static void UpdateTiles(List <GameObject> rmcs)
    {
        for (int i = 0; Loader.Isloading?i < 1 : i < 2; i++)
        {
            foreach (GameObject rmc_o in rmcs)
            {
                rmc_o.layer = 9;
                // Match RMC up and take care of current_heights table
                Calculate_All_RMC_points(rmc_o);
                //Match_rmc2rmc(rmc_o);
                Vector3Int pos = Vpos2tpos(rmc_o);
                //Delete old prefab and replace it with plain new
                if (rmc_o.transform.childCount != 0)
                {
                    DestroyImmediate(rmc_o.transform.GetChild(0).gameObject);
                }

                Vector3Int tileDims = GetRealTileDims(rmc_o);

                Hide_underlying_grass(rmc_o.transform.position);

                Consts.UpdateMapColliders(rmc_o.transform.position, tileDims);
                bool       Mirrored = Consts.TilePlacementArray[pos.z, pos.x].Inversion;
                int        Rotation = Consts.TilePlacementArray[pos.z, pos.x].Rotation;
                byte       Height   = Consts.TilePlacementArray[pos.z, pos.x].Height;
                GameObject Prefab   = GetPrefab(rmc_o.name, rmc_o.transform, Rotation);
                GetPrefabMesh(Mirrored, Prefab);
                Tile_To_Grass_Cast(Prefab, rmc_o);
                rmc_o.layer = 9;
            }
        }
    }
    static float Calculate_vertical_height(Vector3Int v)
    {
        float h1 = Consts.current_heights[Consts.PosToIndex(v.x, v.z - (v.z % 4))];
        float h2 = Consts.current_heights[Consts.PosToIndex(v.x, v.z + (4 - (v.z % 4)))];

        return(Mathf.Lerp(h1, h2, v.z % 4f / 4f));
    }
    static float Calculate_horizontal_height(Vector3Int v)
    {
        float h1 = Consts.current_heights[Consts.PosToIndex(v.x - (v.x % 4), v.z)];
        float h2 = Consts.current_heights[Consts.PosToIndex(v.x + (4 - (v.x % 4)), v.z)];

        return(Mathf.Lerp(h1, h2, v.x % 4f / 4f));
    }
Example #9
0
        private DashboardViewModels CreateDashboard_Pack23ViewModel(Models.Message deviceMessage)
        {
            DashboardViewModels dashboard = new DashboardViewModels();

            dashboard.DeviceId    = deviceMessage.DeviceId;
            dashboard.Name        = deviceMessage.Device.Name;
            dashboard.Package     = deviceMessage.Data;
            dashboard.TypePackage = deviceMessage.TypePackage;
            dashboard.Date        = deviceMessage.Date;
            dashboard.Country     = deviceMessage.Country;
            dashboard.Lqi         = deviceMessage.Lqi;
            dashboard.Bits        = deviceMessage.Bits;
            dashboard.SeqNumber   = deviceMessage.SeqNumber;

            var _fluxoAgua   = FromFloatSafe(deviceMessage.FluxoAgua);
            var _consumoAgua = FromFloatSafe(deviceMessage.ConsumoAgua);

            dashboard.FluxoAgua   = String.Format("{0:0.0}", _fluxoAgua);
            dashboard.ConsumoAgua = String.Format("{0:0.0}", _consumoAgua);

            var _display = Consts.GetDisplayTRM10(dashboard.Bits.BAlertaMax, dashboard.Bits.ModoFechado, dashboard.Bits.ModoAberto);

            dashboard.Modo        = _display.DisplayModo;   // modo
            dashboard.Estado      = _display.DisplayEstado; // alerta
            dashboard.EstadoImage = _display.EstadoImage;
            dashboard.ModoImage   = _display.ModoImage;
            dashboard.Valvula     = _display.DisplayValvula;
            dashboard.EstadoColor = _display.EstadoColor;

            return(dashboard);
        }
Example #10
0
        private int MoveIndexBy(AiPoint[] points, int index, float dist)
        {
            Vector3 currentPoint = Consts.FromArray(points[index].Position);
            var     newIndex     = index;
            Vector3 newPoint     = Consts.FromArray(points[newIndex].Position);
            bool    flag         = false;

            while (Vector3.Distance(currentPoint, newPoint) < dist)
            {
                newIndex++;
                if (newIndex == points.Length)
                {
                    if (!flag)
                    {
                        newIndex = 0;
                        flag     = true;
                    }
                    else
                    {
                        break;
                    }
                }
                newPoint = Consts.FromArray(points[newIndex].Position);
            }
            return(newIndex);
        }
Example #11
0
        public void Execute(IJobExecutionContext context)
        {
            string className    = context.JobDetail.JobDataMap.Get(Consts.JobClassName).ToString();
            string assemblyPath = context.JobDetail.JobDataMap.Get(Consts.JobAssemblyPath).ToString();

            try
            {
                Assembly assembly = Consts.GetAssembly(assemblyPath);
                BaseJob  job      = assembly.CreateInstance(className) as BaseJob;

                object p  = context.JobDetail.JobDataMap.Get(Consts.JobParameter);
                string ps = p == null ? string.Empty : p.ToString();

                job.Execute(ps);

                WriteJobLog((JobDetailImpl)context.JobDetail);
            }
            catch (Exception ex)
            {
                Exception wrapper = new Exception(string.Format("Job异常, assembly:{0}; class:{1}", assemblyPath, className), ex);
                // LogManager.LogException(wrapper);

                WriteJobLog((JobDetailImpl)context.JobDetail, ex);
            }
        }
 private void Clear()
 {
     Fields.Clear();
     Consts.Clear();
     Enums.Clear();
     SyntaxTree = null;
 }
Example #13
0
        //AnsEntry
        void ProcessCommand_AnsEntry(Message m, Host h)
        {
            if (h == null && (Config.IgnoreNoAddListFlag || !Consts.Check(m.Options, Consts.Cmd_Send_Option.NoAddList)))
            {
                h = new Host()
                {
                    ClientVersion = string.Empty,
                    GroupName     = m.ExtendMessage,
                    HasShare      = false,
                    HostSub       = new HostSub()
                    {
                        HostName = m.HostName, Ipv4Address = m.HostAddr, UserName = m.UserName
                    },
                    Index = 0,
                    IsEnhancedContractEnabled = Consts.Check(m.Options, Consts.Cmd_All_Option.EnableNewDataContract),
                    NickName = m.NormalMsg
                };
                if (Consts.Check(m.Options, Consts.Cmd_All_Option.Absence))
                {
                    h.ChangeAbsenceMode(true, Resources.CommandExecutor_ProcessCommand_Br_Entry_LeaveModeText);
                }
                LivedHost.Add(m.HostAddr.Address.ToString(), h);
                h.AbsenceModeChanged += Host_AbsendModeChanged;

                //立刻查询离开消息
                if (h.IsInAbsenceMode)
                {
                    Host_AbsendModeChanged(h, null);
                }
                m.Host = h;
            }

            h.SupportEncrypt       = Consts.Check(m.Options, Consts.Cmd_All_Option.Encrypt);
            h.SupportFileTransport = Consts.Check(m.Options, Consts.Cmd_All_Option.FileAttach);
        }
Example #14
0
    public void SpawnRandomBounded(Bounds bounds)
    {
        Vector3 pos = Consts.GetPositionWithinBounds(bounds);

        if ((pos - transform.position).magnitude < 5.0f)
        {
            return;
        }

        Vector3    sizer = new Vector2(8, 8);
        Collider2D coll  = Physics2D.OverlapArea(pos - sizer, pos + sizer);

        if (coll != null && !(coll.CompareTag("Environment") || coll.CompareTag("Respawn")))
        {
            return;
        }

        int    idx    = Random.Range(0, picker.Count);
        string letter = picker[idx];

        GameObject u = Instantiate(unit, pos, Quaternion.identity, transform);

        u.name = letter;
        u.transform.Find("Letter").GetComponent <TextMeshPro>().text = letter;
    }
    internal void CopySelectionToClipboard()
    {
        CopyClipboard.Clear();
        // Save height for fixed height options
        fixed_height = ShapeMenu.BL.y;
        // reserve place for first marking = Vector3 zero.
        CopyClipboard.Add(Vector3.zero);
        foreach (int index in ShapeMenu.markings.Keys)
        {
            GameObject mrk = ShapeMenu.markings[index];
            if (mrk.name == "on")
            {
                Vector3 pos = Consts.RoundVector3(Consts.IndexToPos(index) - ShapeMenu.BL);
                if (pos.x == 0 && pos.z == 0)
                {
                    continue;
                }
                else
                {
                    CopyClipboard.Add(pos);
                }
            }
        }
        SelectionRotationVal = 0;

        SwitchState(CopyState.copying);
    }
Example #16
0
        public async Task <Product> FindProductByUrl(string url)
        {
            var cacheKey = Consts.GetCachePrefix(Consts.CachePrefix.ProductUrl, url);

            if (_cache.TryGetValue(cacheKey, out var product))
            {
                return(FreshenProduct(product as Product));
            }

            var newProduct = await _context.Products
                             .Where(p => p.Status != (int)Consts.Status.Deleted)
                             .Include(p => p.Category)
//                .Include(p => p.Brand)
                             .Include(p => p.Images)
                             .Include(p => p.Reviews)
                             .ThenInclude(r => r.User)
                             .Include(p => p.Extras)
                             .ThenInclude(extra => extra.Options)
                             .FirstOrDefaultAsync(p => p.NameUrl.Equals(url, StringComparison.CurrentCultureIgnoreCase));

            if (newProduct != null)
            {
                newProduct = FreshenProduct(newProduct);
            }
            _cache.Set(cacheKey, newProduct);
            return(newProduct);
        }
Example #17
0
    public void LoadTrackToVariablesAndRunEditor(string path = "")
    {
        if (path == "")
        {
            string[] sourcepath = StandaloneFileBrowser.OpenFilePanel("Select track (.trk) ", Consts.LoadLastFolderPath(), "trk", false);
            if (sourcepath.Length == 0)             // player has clicked 'cancel' button
            {
                return;
            }
            path = sourcepath[0];
        }
        Consts.SaveTrackInfo(path);
        Consts.SaveLastFolderPath(Path.GetDirectoryName(path));
        Consts.SaveLastMap(Path.GetFileNameWithoutExtension(path));

        if (ResizeToggle.isOn)
        {
            LoadMenu.SetActive(false);
            ResizeMenu.SetActive(true);
            UpdateResizeMenu();
        }
        else
        {
            Loader.Isloading = true;
            ChangeSceneToEditor();
        }
    }
Example #18
0
        private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            // update
            if (System.Threading.Monitor.TryEnter(_syncObject) == false)
            {
                return;
            }
            try
            {
                if (!_actSystemState.HasValue && _needConfigRead)
                {
                    _needConfigRead = false;
                    GetShutdownActionsFromSettings();
                }

                UpdateButtonEnabled();

                if (_actSystemState.HasValue)
                {
                    // calculate Remaining Minutes
                    TimeSpan ts      = DateTime.Now - _startTime;
                    int      minutes = (int)ts.TotalMinutes;
                    int      rMin    = InitialMinutes - minutes;

                    if (RemainingMinutes != rMin)
                    {
                        RemainingMinutes = rMin;
                    }

                    ILocalization localization = ServiceRegistration.Get <ILocalization>();

                    string actionString = localization.ToString(Consts.GetResourceIdentifierForMenuItem(_actSystemState.Value));
                    string res          = localization.ToString((RemainingMinutes <= 1) ? "[SleepTimer.ShutdownTextSingle]" : "[SleepTimer.ShutdownTextMulti]",
                                                                actionString, RemainingMinutes);

                    if (res != ShutdownText)
                    {
                        ShutdownText = res;
                    }

                    if (RemainingMinutes <= 0)
                    {
                        // finished, stop SleepTimer and do the action
                        SystemStateAction toDo = _actSystemState.Value;
                        Stop();
                        DoAction(toDo);
                    }
                }
                else
                {
                    ShutdownText     = string.Empty;
                    RemainingMinutes = 0;
                }
            }
            finally
            {
                System.Threading.Monitor.Exit(_syncObject);
            }
        }
 void MousewheelWorks(float sliderval)
 {
     if (copystate == CopyState.copying)
     {
         fixed_height = Consts.SliderValue2RealHeight(sliderval);
         UpdatePreview();
     }
 }
Example #20
0
        public void writeEvent(string message, Consts.eventType eventType, int eventLevel)
        {
            Consts.writeEnteringMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);
            GenericEventArgs eventArgs = new GenericEventArgs(message, eventType, eventLevel);

            writeEventToFile(this, eventArgs);
            Consts.writeExitingMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);
        }
Example #21
0
        public void ClearCache(Product p)
        {
            var cacheIdKey = Consts.GetCachePrefix(Consts.CachePrefix.ProductId, p.Id);
            var cacheIdUrl = Consts.GetCachePrefix(Consts.CachePrefix.ProductUrl, p.NameUrl);

            _cache.Remove(cacheIdKey);
            _cache.Remove(cacheIdUrl);
        }
Example #22
0
 /// <summary>
 /// 获取用户的会话,不要在构造函数使用
 /// </summary>
 /// <returns></returns>
 protected async Task <UserSession> GetSessionAsync()
 {
     if (Token != null)
     {
         return(await Consts.Get <SessionProvider>().Get(Token));
     }
     return(null);
 }
Example #23
0
 public void RemoveAds()
 {
     Consts.RemoveAds();
     if (bannerView != null)
     {
         HideBanner();
     }
 }
Example #24
0
        public ActionResult Edit(int id)
        {
            Consts.CheckIfLoggedIn(System.Web.HttpContext.Current);
            Visit visit = LoadMainDoctorDDLOptions(VisitFromId(id));

            visit.InitDateTime();
            return(View(visit));
        }
Example #25
0
        // Declaration of methods and such
        public string Death()
        {
            string dtext = "";

            dtext += (isalive = Consts.nrand(StatBlock.PainTolerance, 15) > damage) ? "" : CBTDesc.PickDeath();

            return(dtext);
        }
Example #26
0
    public void ChangeLanguage()
    {
        LanguagesNames name = GetLanguageByName(PlayerPrefs.GetString(LANGUAGE, LanguagesNames.Português.ToString()));

        LanguageDefined = GetLanguageIndexByName(name);
        Lang            = DecideLanguage();
        LanguageIndexer = (int)LanguageDefined;
    }
Example #27
0
 /// <summary>
 /// 获取用户的会话,不要在构造函数使用
 /// </summary>
 /// <returns></returns>
 public UserSession GetSession()
 {
     if (Token != null)
     {
         return(Consts.Get <SessionProvider>().Get(Token));
     }
     return(null);
 }
    /// <summary>
    /// Returns ALL or ONLY RESTRICTED borders of tile
    /// </summary>
    List <int> Get_border_keys(GameObject rmc, bool only_restricted = false)
    {
        List <int> borders = new List <int>();
        string     rmcName = rmc.GetComponent <BorderInfo>().info;
        Vector3    dims    = new Vector3Int(TileManager.TileListInfo[rmc.name].Size.x, 0, TileManager.TileListInfo[rmc.name].Size.y);
        Vector3    TL      = new Vector3(-2 * dims.x, 0, 2 * dims.z);


        // move in local space for x
        for (int x = 1; x <= dims.x; x++)
        {
            if (only_restricted && !rmcName.Contains("V" + x.ToString()))
            {
                continue;
            }
            Vector3 initialPos;
            if (x == 1)
            {
                initialPos = TL + 2 * Vector3.right;
            }
            else             // i = 2
            {
                initialPos = TL + 6 * Vector3.right;
            }

            for (int z = 0; z <= dims.z; z++)
            {
                Vector3 pos = initialPos + z * 4 * Vector3.back;
                pos = rmc.transform.TransformPoint(pos);
                borders.Add(Consts.PosToIndex(pos));
            }
        }
        // move in local space for z
        for (int z = 1; z <= dims.z; z++)
        {
            if (only_restricted && !rmcName.Contains("H" + z.ToString()))
            {
                continue;
            }
            Vector3 initialPos;
            if (z == 1)
            {
                initialPos = TL + 2 * Vector3.back;
            }
            else
            {
                initialPos = TL + 6 * Vector3.back;
            }

            for (int x = 0; x <= dims.x; x++)
            {
                Vector3 pos = initialPos + x * 4 * Vector3.right;
                pos = rmc.transform.TransformPoint(pos);
                borders.Add(Consts.PosToIndex(pos));
            }
        }
        return(borders);
    }
Example #29
0
        public ActionResult Details(int id)
        {
            Consts.CheckIfLoggedIn(System.Web.HttpContext.Current);

            Patient p = PatientFromId(id);

            p = LoadAdmissionsList(p);
            return(View(p));
        }
Example #30
0
        public string Attack(Entity target)
        {
            string attext = "";

            double acc = 0;

            if ((acc = Consts.nrand(StatBlock.FineMoter - target.StatBlock.Flexibility, 15)) > 0)
            {
                attext += CBTDesc.PickAtkhit();

                if (target is Characters.Character)
                {
                    double boost = Math.Pow(acc, 1 / Math.E);

                    target.StatBlock.Flexibility += boost;
                }

                double dmg = 0;

                if ((dmg = acc + Consts.nrand(StatBlock.Strength - target.StatBlock.PainTolerance, 15)) > 0)
                {
                    attext        += CBTDesc.PickAtkdamage();
                    target.damage += dmg;

                    if (target is Characters.Character)
                    {
                        double boost = Math.Pow(dmg, 1 / Math.E);

                        target.StatBlock.PainTolerance += boost;
                    }
                }
                else
                {
                    attext += CBTDesc.PickAtknodamage();

                    if (this is Characters.Character)
                    {
                        double boost = Math.Pow(-dmg, 1 / Math.E);

                        StatBlock.Strength += boost;
                    }
                }
            }
            else
            {
                attext += CBTDesc.PickAtkmiss();

                if (this is Characters.Character)
                {
                    double boost = Math.Pow(-acc, 1 / Math.E);

                    StatBlock.FineMoter += boost;
                }
            }

            return(attext + target.Death());
        }
Example #31
0
    // ============================== GENERAL ==============================

    public void Init()
    {
        root       = null;
        dataLoaded = false;

        LoadLevelData();
        Consts.Init();
        DrawLayerMngr.Init();
    }
        public static SelectList GetAuctionViewModeList(Consts.AuctonViewMode selectedValue)
        {
            List<EnumHelper<string, int>> listAuctionViewMode = new List<EnumHelper<string, int>>();

              foreach (int value in Enum.GetValues(typeof(Consts.AuctonViewMode)))
              {
            listAuctionViewMode.Add(new EnumHelper<string, int>(Enum.GetName(typeof(Consts.AuctonViewMode), value), value));
              }

              return new SelectList(listAuctionViewMode, "Value", "Text", (int)selectedValue);
        }
Example #33
0
        public void addNewPreviousAction(Consts.characterGeneralActions newAction)
        {
            Consts.writeEnteringMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);
            actionHistory actionToAdd;

            actionToAdd._action = newAction;
            actionToAdd._timestamp = new Gametime(Program._gametime);

            if (this._characterPreviousActions.Count > 10)
            {
                this._characterPreviousActions.RemoveAt(0);
            }//if there are more than 10 saved previous actions then remove the oldest one
            this._characterPreviousActions.Add(actionToAdd);
            Consts.writeExitingMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);
        }
Example #34
0
        public BuildingForLiving(int idValue,int ownerIDValue, int typeValue, string nameValue, Status hpValue, int costToBuildValue, Status levelValue, Gametime startBuildTimeValue,
                                 int numberOfManBuildingHoursValue, Status tenantsValue, int[] tenantsIDValue, Consts.buildingState buildingStateValue)
            : base(idValue, ownerIDValue, typeValue, nameValue, hpValue, costToBuildValue, levelValue, startBuildTimeValue, numberOfManBuildingHoursValue, buildingStateValue)
        {
            _tenants = new Status(tenantsValue);

            if (tenantsIDValue != null)
            {
                _tenantsID = new int[tenantsIDValue.Length];
                for (int i = 0; i < tenantsIDValue.Length; i++)
                {
                    _tenantsID[i] = tenantsIDValue[i];
                }
            }
            else _tenantsID = null;
        }
Example #35
0
 public Job(int jobID, int buildingID, int ownerID, int workerID, string jobName, Gametime startDate, Gametime endDate, Gametime startTime, Gametime endTime, int payroll, Consts.JobStatus jobStatus)
 {
     if (startDate <= endDate &&
         startTime <= endTime)
     {
         _jobID = jobID;
         _buildingID = buildingID;
         _ownerID = ownerID;
         _workerID = workerID;
         _jobName = String.Copy(jobName);
         _startDate = new Gametime();
         _startDate.CopyGameTime(startDate);
         _endDate = new Gametime();
         _endDate.CopyGameTime(endDate);
         _startTime = new Gametime();
         _startTime.CopyGameTime(startTime);
         _endTime = new Gametime();
         _endTime.CopyGameTime(endTime);
         _payroll = payroll;
         _jobStatus = jobStatus;
     }
 }
Example #36
0
 public GenericEventArgs(string targetMessage, Consts.eventType targetEventType, int targetEventLevel)
 {
     _message = string.Copy(targetMessage);
     _eventType = targetEventType;
     _eventlevel = targetEventLevel;
 }
Example #37
0
		/// <summary>
		/// 直接创建一个新的Message对象
		/// </summary>
		/// <param name="host">主机对象</param>
		/// <param name="addr">远程地址</param>
		/// <param name="packagerNumber">端口</param>
		/// <param name="hostName">主机名</param>
		/// <param name="userName">用户名</param>
		/// <param name="command">命令</param>
		/// <param name="options">选项</param>
		/// <param name="message">信息</param>
		/// <param name="extendMessage">扩展信息</param>
		/// <returns></returns>
		public static Message Create(Host host, IPEndPoint addr, ulong packagerNumber, string hostName, string userName, Consts.Commands command, ulong options, string message, string extendMessage)
		{
			return new Message(addr, packagerNumber, hostName, userName, command, options, message, extendMessage) { Host = host };
		}
Example #38
0
		/// <summary>
		/// 发送消息
		/// </summary>
		/// <param name="host">主机</param>
		/// <param name="remoteEndPoint">远程主机地址</param>
		/// <param name="cmd">命令</param>
		/// <param name="options">选项</param>
		/// <param name="msg">消息</param>
		/// <param name="extMsg">扩展消息</param>
		/// <param name="isBroadCast">是否是广播</param>
		/// <param name="sendCheck">是否需要确认收到</param>
		/// <param name="noAddList">是否忽略到主机列表</param>
		/// <param name="noLog">是否不记录日志</param>
		/// <param name="isAutoRet">是否是自动回复</param>
		/// <param name="isEncrypt">是否是加密信息</param>
		/// <param name="isSecret">是否需要阅读确认</param>
		/// <param name="noPopup">是否不自动弹出</param>
		/// <returns>发出去的消息包编号</returns>
		public ulong SendCommand(Host host, IPEndPoint remoteEndPoint, Consts.Commands cmd, ulong options, string msg, string extMsg, bool isBroadCast, bool sendCheck
			, bool noAddList, bool noLog, bool isAutoRet, bool isEncrypt, bool isSecret, bool noPopup)
		{
			if (isBroadCast) options |= (ulong)Consts.Cmd_Send_Option.BroadCast;
			if (sendCheck) options |= (ulong)Consts.Cmd_Send_Option.SendCheck;
			if (noAddList) options |= (ulong)Consts.Cmd_Send_Option.NoAddList;
			if (noLog) options |= (ulong)Consts.Cmd_Send_Option.NoLog;
			if (isAutoRet) options |= (ulong)Consts.Cmd_Send_Option.AutoRet;
			if (isEncrypt) options |= (ulong)Consts.Cmd_All_Option.Encrypt;
			if (isSecret) options |= (ulong)Consts.Cmd_Send_Option.Secret;
			if (noPopup) options |= (ulong)Consts.Cmd_Send_Option.NoPopup;

			if (sendCheck && host != null)
			{
				return MessageProxy.SendWithCheck(host, cmd, options, msg, extMsg);
			}
			else
			{
				if (host == null) return MessageProxy.SendByIp(remoteEndPoint, cmd, options, msg, extMsg);
				else return MessageProxy.SendWithNoCheck(host, cmd, options, msg, extMsg);
			}
		}
Example #39
0
		/// <summary>
		/// 发送消息
		/// </summary>
		/// <param name="remoteEndPoint">远程主机地址</param>
		/// <param name="cmd">命令</param>
		/// <param name="options">选项</param>
		/// <param name="msg">消息</param>
		/// <param name="extMsg">扩展消息</param>
		/// <param name="isBroadCast">是否是广播</param>
		/// <param name="sendCheck">是否需要确认收到</param>
		/// <param name="noAddList">是否忽略到主机列表</param>
		/// <param name="noLog">是否不记录日志</param>
		/// <param name="isAutoRet">是否是自动回复</param>
		/// <param name="isEncrypt">是否是加密信息</param>
		/// <param name="isSecret">是否需要阅读确认</param>
		/// <param name="noPopup">是否不自动弹出</param>
		/// <returns>发出去的消息包编号</returns>
		public ulong SendCommand(IPEndPoint remoteEndPoint, Consts.Commands cmd, ulong options, string msg, string extMsg, bool isBroadCast, bool sendCheck, bool noAddList, bool noLog, bool isAutoRet, bool isEncrypt, bool isSecret, bool noPopup)
		{
			return SendCommand(null, remoteEndPoint, cmd, options, msg, extMsg, isBroadCast, sendCheck, noAddList, noLog, isAutoRet, isEncrypt, isSecret, noPopup);
		}
Example #40
0
		/// <summary>
		/// 发送消息
		/// </summary>
		/// <param name="host">主机对象</param>
		/// <param name="endPoint">主机地址</param>
		/// <param name="cmd">命令</param>
		/// <param name="options">选项</param>
		/// <param name="msg">消息</param>
		/// <param name="extMsg">扩展消息</param>
		/// <returns>发出去的消息包编号</returns>
		public ulong SendCommand(Host host, IPEndPoint endPoint, Consts.Commands cmd, ulong options, string msg, string extMsg)
		{
			return SendCommand(host, endPoint, cmd, options, msg, extMsg, false, false, false, false, false, false, false, false);
		}
Example #41
0
		/// <summary>
		/// 发送消息
		/// </summary>
		/// <param name="endPoint">主机地址</param>
		/// <param name="cmd">命令</param>
		/// <param name="options">选项</param>
		/// <param name="msg">消息</param>
		/// <param name="extMsg">扩展消息</param>
		/// <returns>发出去的消息包编号</returns>
		public ulong SendCommand(IPEndPoint endPoint, Consts.Commands cmd, ulong options, string msg, string extMsg)
		{
			return SendCommand(null, endPoint, cmd, options, msg, extMsg);
		}
Example #42
0
		public Message(IPEndPoint addr, ulong packagerNumber, string hostName, string userName, Consts.Commands command, ulong options, string message, string extendMessage)
		{
			HostAddr = addr;
			Handled = false;

			PackageNo = packagerNumber;
			HostName = hostName;
			UserName = userName;
			Command = command;
			Options = System.Convert.ToUInt32(options);
			NormalMsg = message;
			ExtendMessage = extendMessage;
		}
Example #43
0
        public void delayTargetAction(Consts.characterGeneralActions targetAction)
        {
            int index = -2;
            if (targetAction != Consts.characterGeneralActions.Idle && _characterActions.actionExistsInQueue(targetAction))
            {
                for (int i = 0; i < _characterActions.Count; i++)
                {
                    if (_characterActions.ElementAt(i).Action == targetAction)
                    {
                        index = i;
                    }
                }//finds the index of action

                if (index != -2)
                {
                    CharacterAction temp;
                    if (_characterActions.ElementAt(index + 1).Action != Consts.characterGeneralActions.Idle)
                    {
                        _characterActions.
                    }//if element after the target action is not idle, then swap the two actions
                }
            }
        }
 //GetHomepageImages
 public List<HomepageImage> GetHomePageImages(Consts.HomepageImageType imgtype)
 {
   var dco = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.HOTNEWS, "GETHOMEPAGEIMAGES",
     new object[] { }, CachingExpirationTime.Minutes_05);
   var result = _cacheRepository.Get(dco) as List<HomepageImage>;
   if (result != null && result.Any())
     return result.Where(r => r.IsEnabled && r.ImgType == (byte)imgtype).ToList();
   result = _dataContext.spImages_Homepage().ToList();
   if (result.Any())
   {
     dco.Data = result;
     _cacheRepository.Add(dco);
   }
   return result.Where(r => r.IsEnabled && r.ImgType == (byte)imgtype).ToList();
 }
Example #45
0
 public LinkedList<Building> searchBuildingsByBuildingState(Consts.buildingState state)
 {
     Consts.writeEnteringMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);
     LinkedList<Building> results = new LinkedList<Building>();
     foreach (Building building in _buildingsList)
     {
         if (building.BuildingState == state)
         {
             results.AddLast(building);
         }//found building with right building state
     }
     Consts.writeExitingMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);
     return results;
 }