コード例 #1
0
    static public void GetWetTarget(ref List <Life> targetlist, SkillInfo skill, Life own)
    {
        float       radius = ConfigM.GetWetBodyRange() * 0.01f;
        List <Life> lr     = new List <Life>();
        LifeMCamp   camp   = GetSkillCamp(skill, own);

        CM.SearchLifeMListInBoat(ref lr, LifeMType.SOLDIER, camp);
        for (int i = 0; i < targetlist.Count; i++)
        {
            Life l = targetlist[i];
            foreach (Role r in lr)
            {
                if (NdUtil.IsSameMapLayer(l.MapPos, r.MapPos))
                {
                    if (r.m_thisT.localPosition.x >= (l.m_thisT.localPosition.x - radius) && r.m_thisT.localPosition.x <= (l.m_thisT.localPosition.x + radius))
                    {
                        if (r.m_Attr.IsWetBody)
                        {
                            if (!targetlist.Contains(r))
                            {
                                targetlist.Add(r);
                            }
                        }
                    }
                }
            }
        }
    }
コード例 #2
0
        public static void ExecuteTransaction(SqlCommand[] CMD)
        {
            SqlConnection _Scon = GetConnection();

            if (CMD.Length > 0)
            {
                _Scon.Open();
                SqlTransaction Xtran = _Scon.BeginTransaction();
                try
                {
                    foreach (SqlCommand CM in CMD)
                    {
                        CM.Connection  = _Scon;
                        CM.Transaction = Xtran;
                        CM.ExecuteNonQuery();
                    }
                    Xtran.Commit();
                }
                catch (Exception ex)
                {
                    Xtran.Rollback();
                    throw ex;
                }
                finally
                {
                    if (_Scon.State == ConnectionState.Open)
                    {
                        _Scon.Close();
                    }
                }
            }
        }
コード例 #3
0
ファイル: Form3.cs プロジェクト: pinkopaio8/ProjectClock
        private void FinalCountdown(object sender, EventArgs e)
        {
            CS = CS - n;
            if (CS < 10)
            {
                label3.Text = "0" + CS;
            }
            else
            {
                label3.Text = CS.ToString();
            }

            if (CS < 0)
            {
                CS          = 59;
                label3.Text = CS.ToString();
                CM          = CM - n;
                if (CM < 10)
                {
                    label2.Text = "0" + CM;
                }
                else
                {
                    label2.Text = CM.ToString();
                }
                if (CM < 0)
                {
                    CM          = 59;
                    label2.Text = CM.ToString();
                    CH          = CH - n;
                    if (CH < 10)
                    {
                        label1.Text = "0" + CH;
                    }
                    else
                    {
                        label1.Text = CH.ToString();
                    }
                    if (CH < 0)
                    {
                        CH          = 0;
                        label1.Text = CH.ToString();
                    }
                }
            }
            if (CH == 0 && CM == 0 && CS == 0)
            {
                Time.Stop();
                CH          = 0;
                CM          = 0;
                CS          = 0;
                label1.Text = "00";
                label2.Text = "00";
                label3.Text = "00";
                MessageBox.Show("TEMPO CONCLUSO.");
                Enable();
                //Time.Enabled = false;
                return;
            }
        }
コード例 #4
0
        private void saveAndClose()
        {
            if (CM != null)
            {
                CM.disconnectEverything();
            }

            if (SessionMgr != null)
            {
                if (SessionMgr.endSession())
                {
                    showMessageBox("Actions_Saved_Title", "Actions_Saved_Content",
                                   (res) =>
                    {
                        //Execute Shutdown.
                        MessengerInstance.Send <ApplicationClosing>(new ApplicationClosing(false));
                    });
                }
                else
                {
                    showMessageBox("MessageBox_Error_Title", "Actions_Error_CouldntSave", null);
                }
            }
            else
            {
                _Log.Error("Session Manager N/A");
            }
        }
コード例 #5
0
ファイル: Life.cs プロジェクト: 741645596/batgame
 /// <summary>
 /// 设置lifeM 核心结构
 /// </summary>
 /// <returns></returns>
 public virtual int SetLifeCore(LifeMCore Core)
 {
     m_SceneID = NdUtil.GetSceneID();
     m_Core.Copy(Core);
     CM.JoinCombat(m_SceneID, this, Core);
     return(m_SceneID);
 }
コード例 #6
0
 private void btdn_Click(object sender, EventArgs e)
 {
     if (PK_TaiKhoan(TK.Text) == false)
     {
         con.Open();
         SqlCommand cmd = new SqlCommand("select dsthi.msts,dsthisinh.cmnd" +
                                         " from DSTHISINH, dsthi " +
                                         " where dsthisinh.msts = dsthi.msts" +
                                         " and dsthi.msts='" + TK.Text + "'", con);
         SqlDataReader reader = cmd.ExecuteReader();
         reader.Read();
         if (reader.GetValue(1).ToString() == CM.Text)
         {
             DDN  = true;
             MSTS = TK.Text;
             this.Close();
         }
         else if (reader.GetValue(0).ToString() != CM.Text)
         {
             MessageBox.Show("Sai Mật Khẩu", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             CM.Focus();
             con.Close();
             return;
         }
         else
         {
             MessageBox.Show("Tài Khoản Không Tồn Tại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             TK.Focus();
             con.Close();
             return;
         }
         con.Close();
     }
 }
コード例 #7
0
ファイル: AIPathData.cs プロジェクト: 741645596/batgame
    /// <summary>
    /// 检测是否有可触发陷阱,判断标准,为陷阱,且不处于cd
    /// </summary>
    /// <returns>false,没有,true 有</returns>
    public bool CheckTrap()
    {
        if (Road == null)
        {
            return(false);
        }
        List <int> l = new List <int>();

        Road.GetBuildList(ref l);
        foreach (int SceneID in l)
        {
            Life life = CM.GetLifeM(SceneID, LifeMType.BUILD);
            if (life == null)
            {
                continue;
            }
            if (life is Building)
            {
                Building build = life as Building;
                if (!build.IsInCDStatus())
                {
                    return(true);
                }
            }
        }
        return(false);
    }
コード例 #8
0
    public override void BuildUpdate()
    {
        base.BuildUpdate();
        m_vCurGreed = m_vDirGreed;
        Pao.transform.localRotation = Quaternion.Euler(m_vCurGreed);
        if (Time.time - m_fCheckRoleInSmallCirle > 0.2f)
        {
            List <Life> RoleList    = new List <Life>();
            List <Life> newRoleList = new List <Life>();
            CM.SearchLifeMList(ref RoleList, null, LifeMType.SOLDIER /*| LifeMType.PET*/, LifeMCamp.ALL, MapSearchStlye.Circle, this, (MapGrid.m_width * 150) / MapGrid.m_Pixel);
            if (RoleList.Count > 0)
            {
                (m_Property as BuildProperty).SetColor("_Color", new Color(1.0f, 1.0f, 1.0f, 0.196f));
            }
            else
            {
                (m_Property as BuildProperty).SetColor("_Color", new Color(1.0f, 1.0f, 1.0f, 1.0f));
            }
        }
        if (m_bAttack && Time.time - m_fAttackTime > 0.5f)
        {
            m_bAttack = false;
            SoundPlay.Play("trap_cannon_land", false, false);
            ActiveEffect1915011(false);

            SetAnimator(Build_AnimatorState.Stand10000);
        }
    }
コード例 #9
0
 public SearchComponent(string fieldName, SM searchMode, object value, CM conditionMode)
 {
     this._fieldName     = fieldName;
     this._searchmode    = searchMode;
     this._value         = value;
     this._conditionMode = conditionMode;
 }
コード例 #10
0
    protected NDAttribute GetBuildRoomAttr(Life parent, int layer, int unit)
    {
        Int2 Pos = new Int2(unit, layer);

        if (parent is LeftFloorWall)
        {
            Pos.Unit += 3;
        }
        else if (parent is rightFloorWall)
        {
            Pos.Unit -= 3;
        }

        MapGrid m = MapGrid.GetMG(Pos);

        if (m != null)
        {
            int BuildRoomSceneID = -1;
            if (m.GetBuildRoom(ref BuildRoomSceneID) == true)
            {
                Life buildRoom = CM.GetLifeM(BuildRoomSceneID, LifeMType.BUILD);
                if (buildRoom != null)
                {
                    return(buildRoom.m_Attr);
                }
            }
        }
        return(null);
    }
コード例 #11
0
ファイル: SV_WORLD.cs プロジェクト: optimus-code/Quake2Sharp
        /*
         * ============= SV_PointContents =============
         */
        public static int SV_PointContents(float[] p)
        {
            edict_t hit;
            int     i, num;
            int     contents, c2;
            int     headnode;

            // get base contents from world
            contents = CM.PointContents(p, SV_INIT.sv.models[1].headnode);

            // or in contents from all the other entities
            num = SV_WORLD.SV_AreaEdicts(p, p, SV_WORLD.touch, Defines.MAX_EDICTS, Defines.AREA_SOLID);

            for (i = 0; i < num; i++)
            {
                hit = SV_WORLD.touch[i];

                // might intersect, so do an exact clip
                headnode = SV_WORLD.SV_HullForEntity(hit);

                if (hit.solid != Defines.SOLID_BSP)
                {
                }

                c2        = CM.TransformedPointContents(p, headnode, hit.s.origin, hit.s.angles);
                contents |= c2;
            }

            return(contents);
        }
コード例 #12
0
ファイル: SV_GAME.cs プロジェクト: optimus-code/Quake2Sharp
        /**
         * PF_inPHS.
         *
         * Also checks portalareas so that doors block sound.
         */
        public static bool PF_inPHS(float[] p1, float[] p2)
        {
            int leafnum;
            int cluster;
            int area1, area2;

            byte[] mask;

            leafnum = CM.CM_PointLeafnum(p1);
            cluster = CM.CM_LeafCluster(leafnum);
            area1   = CM.CM_LeafArea(leafnum);
            mask    = CM.CM_ClusterPHS(cluster);

            leafnum = CM.CM_PointLeafnum(p2);
            cluster = CM.CM_LeafCluster(leafnum);
            area2   = CM.CM_LeafArea(leafnum);

            // quake2 bugfix
            if (cluster == -1)
            {
                return(false);
            }

            if (mask != null && 0 == (mask[cluster >> 3] & (1 << (cluster & 7))))
            {
                return(false);                // more than one bounce away
            }
            if (!CM.CM_AreasConnected(area1, area2))
            {
                return(false);                // a door blocks hearing
            }
            return(true);
        }
コード例 #13
0
        public override void LoadContent()
        {
            font   = CM.Load <SpriteFont>("font");
            button = CM.Load <Texture2D>("button");

            singleplayer = new Button();
            multiplayer  = new Button();
            quit         = new Button();

            singleplayer.Text = "Singleplayer";
            multiplayer.Text  = "Multiplayer";
            quit.Text         = "Quit";

            singleplayer.Click += ButtonClick;
            multiplayer.Click  += ButtonClick;
            quit.Click         += ButtonClick;

            singleplayer.Position = new Vector2(graphicsDevice.Viewport.Width / 2 - 16 * 5, graphicsDevice.Viewport.Height / 2 - 64);
            multiplayer.Position  = new Vector2(graphicsDevice.Viewport.Width / 2 - 16 * 5, graphicsDevice.Viewport.Height / 2 - 16);
            quit.Position         = new Vector2(graphicsDevice.Viewport.Width / 2 - 16 * 5, graphicsDevice.Viewport.Height / 2 + 32);

            compManager.AddComponent(singleplayer);
            compManager.AddComponent(multiplayer);
            compManager.AddComponent(quit);
        }
コード例 #14
0
    // Start is called before the first frame update
    void Start()
    {
        OutputVal    = Color.white;
        CyanValue    = Color.white;
        MagnetaValue = Color.white;
        YellowValue  = Color.white;


        // Maximum Mixture
        float mixtureMultplier = angle / color;
        float piece            = 0;

        while (piece <= color)
        {
            piece += increment;
            mixtureMax++;
        }


        // Set Colors
        CM.SetColorMaterialTransform(TrueValue, ColorMatcher.transform);
        CM.SetColorMaterialTransform(Color.cyan, cyanKnob.transform);
        CM.SetColorMaterialTransform(Color.magenta, magentaKnob.transform);
        CM.SetColorMaterialTransform(Color.yellow, yellowKnob.transform);
    }
コード例 #15
0
        private void insertPanelBtn(object sender, EventArgs e)
        {//Onclick event for insert buttons of panels
            //throw new NotImplementedException();
            IsLoading = true;
            int i = plist.IndexOf((Panel)(((Button)sender).Parent)) + 1;
            int j = comboBoxEntrySelector.SelectedIndex;

            CM.ExecuteCommand(new InsertField(project.entries[j], i));

            IsLoading = true;
            try
            {
                //ProjectToControls(project, j);
                Panel p = new Panel();
                populatePanel(p);
                plist.Insert(i, p);
                p.Visible = false;
                this.Controls.Add(p);
                relocatePanels();
                p.Visible = true;
            }
            finally
            {
                IsLoading = false;
            }

            //EntryNeedsSaving = true;
            //IsLoading = false;
        }
コード例 #16
0
    void Update()
    {
        UpdateNow();

        float takeRad = 10f;

        Collider2D[] soldiersToTake = Physics2D.OverlapCircleAll(transform.position, takeRad, 1 << SM.SoldierLayer);
        foreach (Collider2D sold in soldiersToTake)
        {
            Transform soldier = sold.transform;
            int       index   = freeIndex;
            if (SM.GetArmy(soldier) == army && index != -1 && SM.IsPrivate(soldier.GetComponent <Soldier>()))
            {
                Private priv = SM.AsPrivate(soldier.GetComponent <Soldier>());
                if (!priv.officer && priv.eqSet == eqSet)
                {
                    Vector3 pos = formation[index];
                    priv.deltaV = pos;
                    priv.index  = index;
                    subs[index] = priv.transform.Find("Soldier").GetComponent <Soldier>();
                    priv.SetOfficer(this);
                    soldier.GetComponent <Soldier>().moral = soldier.GetComponent <Soldier>().moral > 50f ? soldier.GetComponent <Soldier>().moral : 50f;
                    soldier.GetComponent <Soldier>().DefendNow();
                    if (CM.Contains(this.transform.Find("Soldier").GetComponent <Soldier>()))
                    {
                        soldier.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Soldier/S_Base_HL_" + army);
                    }
                    else
                    {
                        soldier.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Soldier/S_Base_" + army);
                    }
                }
            }
        }
    }
コード例 #17
0
    protected virtual void StartAttacking(Transform target)
    {
        weapons[equippedWeaponIndex].StartAttacking(target);                  // krece da napada oruzjem
        playerState = PlayerState.ATTACKING;

        CM.StopMoving();
    }
コード例 #18
0
        void ProfileSvc_ProfileLoaded(AsyncOperationInstance operation)
        {
            ProfileSvc.ProfileLoaded -= ProfileSvc_ProfileLoaded;
            var project = ProfileSvc.ProjectID;

            var paths = Settings.getOptions().Paths;


            if (CM.truncateSyncTable())
            {
                CM.disconnectFromMobileDB();
                SessionMgr.endSession();
                SessionMgr.startSession();
                var workingPaths = SessionMgr.createCleanWorkingCopies(paths);
                CM.connectToMobileDB(workingPaths);
            }
            else
            {
                if (CurrentOperation != null)
                {
                    CurrentOperation.failure("Actions_Error_CouldntTruncateSync", "");
                }
                _Log.Info("Could not truncate Sync Table, aborting clean.");
            }


            if (ProfileSvc.ProjectID != project)
            {
                ProfileSvc.ProjectID = project;
            }
            if (CurrentOperation != null)
            {
                CurrentOperation.success();
            }
        }
コード例 #19
0
        private void CommandLine_TextChanged(object sender, TextChangedEventArgs e)
        {
            string        TypedCommand = this.CommandLine.Text;
            List <string> Sug_List     = new List <string>();

            Sug_List.Clear();

            foreach (string CM in CommandList)
            {
                if (!string.IsNullOrEmpty(this.CommandLine.Text))
                {
                    if (CM.StartsWith(TypedCommand))
                    {
                        Sug_List.Add(CM);
                    }
                }
            }

            if (Sug_List.Count > 0)
            {
                this.LB_CommandTypedList.ItemsSource = Sug_List;
                this.LB_CommandTypedList.Visibility  = Visibility.Visible;
            }
            else if (Sug_List.Count > 0)
            {
                this.LB_CommandTypedList.ItemsSource = null;
                this.LB_CommandTypedList.Visibility  = Visibility.Collapsed;
            }
            else
            {
                this.LB_CommandTypedList.ItemsSource = null;
                this.LB_CommandTypedList.Visibility  = Visibility.Collapsed;
            }
        }
コード例 #20
0
ファイル: Player.cs プロジェクト: aeren108/kaymak
        public override void LoadContent()
        {
            sprite    = CM.Load <Texture2D>("cat_fighter");
            FootStep  = CM.Load <SoundEffect>("footsteps").CreateInstance();
            Knockback = CM.Load <SoundEffect>("knockback").CreateInstance();
            Dash      = CM.Load <SoundEffect>("whoosh").CreateInstance();
            font      = CM.Load <SpriteFont>("font");

            RightWalk = new Animation(70, 8, 64, 64, 2);
            LeftWalk  = new Animation(70, 8, 64, 64, 3);
            IdleLeft  = new Animation(120, 4, 64, 64, 1);
            IdleRight = new Animation(120, 4, 64, 64, 0);

            CurAnim         = IdleRight;
            FootStep.Volume = .1f;
            FootStep.Pitch  = .05f;

            Knockback.Volume = 0.4f;
            Knockback.Pitch  = -0.2f;

            Dash.Volume = .2f;
            Dash.Pitch  = .2f;

            Listener          = new AudioListener();
            Listener.Position = new Vector3(Position.X + 32, Position.Y + 32, 0);
        }
コード例 #21
0
        public static trace_t SV_Trace(float[] start, float[] mins, float[] maxs, float[] end, edict_t passedict, int contentmask)
        {
            moveclip_t clip = new moveclip_t();

            if (mins == null)
            {
                mins = Globals.vec3_origin;
            }
            if (maxs == null)
            {
                maxs = Globals.vec3_origin;
            }
            clip.trace     = CM.BoxTrace(start, end, mins, maxs, 0, contentmask);
            clip.trace.ent = GameBase.g_edicts[0];
            if (clip.trace.fraction == 0)
            {
                return(clip.trace);
            }
            clip.contentmask = contentmask;
            clip.start       = start;
            clip.end         = end;
            clip.mins        = mins;
            clip.maxs        = maxs;
            clip.passedict   = passedict;
            Math3D.VectorCopy(mins, clip.mins2);
            Math3D.VectorCopy(maxs, clip.maxs2);
            SV_TraceBounds(start, clip.mins2, clip.maxs2, end, clip.boxmins, clip.boxmaxs);
            SV_ClipMoveToEntities(clip);
            return(clip.trace);
        }
コード例 #22
0
    public List <Life> GetBuildSkillTarget(Life target)
    {
        List <Life> RoleList    = new List <Life>();
        List <Life> newRoleList = new List <Life>();

        CM.SearchLifeMList(ref RoleList, null, LifeMType.SOLDIER | LifeMType.SUMMONPET, LifeMCamp.ATTACK, m_Parent, (m_skill as BuildSkillInfo).m_dSearchInfo);

        if (RoleList.Count > 0)
        {
            CM.SearchAttackLifeMList(ref RoleList, target);
            int nRoleCnt      = 0;
            int nRoleMaxCount = m_skill.m_multiple;
            if (nRoleMaxCount == 0)
            {
                nRoleMaxCount = RoleList.Count;
            }
            for (int i = 0; i < RoleList.Count; i++)
            {
                if (RoleList[i] is  Role && !CheckCanAttack((RoleList[i]  as Role).CurrentAction))
                {
                }
                else
                {
                    newRoleList.Add(RoleList[i]);
                    nRoleCnt++;
                }
                if (nRoleCnt >= nRoleMaxCount)
                {
                    break;
                }
            }
        }
        CheckMultiple(ref newRoleList, m_skill);
        return(newRoleList);
    }
コード例 #23
0
    public bool CheckSkillTrigger(Life target)
    {
        bool        bRelease = false;
        List <Life> RoleList = new List <Life>();

        CM.SearchLifeMList(ref RoleList, null, LifeMType.SOLDIER | LifeMType.SUMMONPET, LifeMCamp.ATTACK, m_Parent, (m_skill as BuildSkillInfo).m_tSearchInfo);

        if (RoleList.Count > 0)
        {
            foreach (Life l in RoleList)
            {
                if (l is  Role && !CheckCanAttack((l as Role).CurrentAction))
                {
                }
                else
                {
                    bRelease = true;
                    m_skill.SetTarget(l, l.GetMapGrid());
                    m_skill.SetTargetV3Pos(l.GetPos());
                    break;
                }
            }
        }
        return(bRelease);
    }
コード例 #24
0
ファイル: SV_CCMDS.cs プロジェクト: optimus-code/Q2Sharp
        public static void SV_WriteLevelFile( )
        {
            String    name;
            QuakeFile f;

            Com.DPrintf("SV_WriteLevelFile()\\n");
            name = FS.Gamedir() + "/save/current/" + SV_INIT.sv.name + ".sv2";
            try
            {
                f = new QuakeFile(name, FileAccess.ReadWrite);
                for (var i = 0; i < Defines.MAX_CONFIGSTRINGS; i++)
                {
                    f.Write(SV_INIT.sv.configstrings[i]);
                }
                CM.CM_WritePortalState(f);
                f.Dispose();
            }
            catch (Exception e)
            {
                Com.Printf("Failed to open " + name + "\\n");
                e.PrintStackTrace();
            }

            name = FS.Gamedir() + "/save/current/" + SV_INIT.sv.name + ".sav";
            GameSave.WriteLevel(name);
        }
コード例 #25
0
 public SearchComponent(string fieldName, SM searchMode, object value, CM conditionMode)
 {
     this._fieldName = fieldName;
       this._searchmode = searchMode;
       this._value = value;
       this._conditionMode = conditionMode;
 }
コード例 #26
0
ファイル: CL_pred.cs プロジェクト: optimus-code/Q2Sharp
        static int PMpointcontents(float[] point)
        {
            int            i;
            entity_state_t ent;
            int            num;
            cmodel_t       cmodel;
            int            contents;

            contents = CM.PointContents(point, 0);
            for (i = 0; i < Globals.cl.frame.num_entities; i++)
            {
                num = (Globals.cl.frame.parse_entities + i) & (Defines.MAX_PARSE_ENTITIES - 1);
                ent = Globals.cl_parse_entities[num];
                if (ent.solid != 31)
                {
                    continue;
                }
                cmodel = Globals.cl.model_clip[ent.modelindex];
                if (cmodel == null)
                {
                    continue;
                }
                contents |= CM.TransformedPointContents(point, cmodel.headnode, ent.origin, ent.angles);
            }

            return(contents);
        }
コード例 #27
0
    public void CheckDead()
    {
        LifeMCamp   camp  = m_Core.m_Camp == LifeMCamp.ATTACK? LifeMCamp.DEFENSE : LifeMCamp.ATTACK;
        List <Life> lb    = new List <Life>();
        int         count = 0;

        if (m_EnemyType == PetEnemyType.Build)
        {
            CM.SearchLifeMListInBoat(ref lb, LifeMType.BUILD, camp);
            foreach (Building b in lb)
            {
                if (b.m_Attr.IsDamage && !b.m_Attr.IsResource)
                {
                    count++;
                }
            }
        }
        else if (m_EnemyType == PetEnemyType.SOLDIER)
        {
            CM.SearchLifeMListInBoat(ref lb, LifeMType.SOLDIER, camp);
            foreach (Role b in lb)
            {
                count++;
            }
        }

        if (count <= 0)
        {
            Dead();
        }
    }
コード例 #28
0
ファイル: DefenseRadarAI.cs プロジェクト: 741645596/batgame
    protected override void GetTargetList(int AttackLike)
    {
        List <Life> RoleList = new List <Life>();

        CM.SearchLifeMListInBoat(ref RoleList, LifeMType.SOLDIER | LifeMType.SUMMONPET, LifeMCamp.ATTACK);
        CheckInVisionAttack(RoleList);
    }
コード例 #29
0
ファイル: SV_CCMDS.cs プロジェクト: optimus-code/Q2Sharp
        public static void SV_ReadLevelFile( )
        {
            String    name;
            QuakeFile f;

            Com.DPrintf("SV_ReadLevelFile()\\n");
            name = FS.Gamedir() + "/save/current/" + SV_INIT.sv.name + ".sv2";
            try
            {
                f = new QuakeFile(name, FileAccess.Read);
                for (var n = 0; n < Defines.MAX_CONFIGSTRINGS; n++)
                {
                    SV_INIT.sv.configstrings[n] = f.ReadString();
                }
                CM.CM_ReadPortalState(f);
                f.Close();
            }
            catch (IOException e1)
            {
                Com.Printf("Failed to open " + name + "\\n");
                e1.PrintStackTrace();
            }

            name = FS.Gamedir() + "/save/current/" + SV_INIT.sv.name + ".sav";
            GameSave.ReadLevel(name);
        }
コード例 #30
0
        public static bool PF_inPHS(float[] p1, float[] p2)
        {
            int leafnum;
            int cluster;
            int area1, area2;

            byte[] mask;
            leafnum = CM.CM_PointLeafnum(p1);
            cluster = CM.CM_LeafCluster(leafnum);
            area1   = CM.CM_LeafArea(leafnum);
            mask    = CM.CM_ClusterPHS(cluster);
            leafnum = CM.CM_PointLeafnum(p2);
            cluster = CM.CM_LeafCluster(leafnum);
            area2   = CM.CM_LeafArea(leafnum);
            if (cluster == -1)
            {
                return(false);
            }
            if (mask != null && (0 == (mask[cluster >> 3] & (1 << (cluster & 7)))))
            {
                return(false);
            }
            if (!CM.CM_AreasConnected(area1, area2))
            {
                return(false);
            }
            return(true);
        }
コード例 #31
0
        // Evento 2
        private bool RequestCM(Evento evento)
        {
            string resultado = "";

            Programa programa = evento.Programa;

            if (evento.Programa.MemoriaNecessaria > CM.MemoriaDisponivel())
            {
                resultado += "Memória Insuficiente. Job aguardará liberação. ";
                CM.Inserir(programa);
            }
            else
            {
                resultado += "Job Carregado na Memória. ";
                CM.Reservar(programa);
                int    tempoRelocacao = CM.TempoDeRelocacao(programa);
                Evento proximoEvento  = new Evento(evento.InstanteChegada + tempoRelocacao,
                                                   TipoEvento.REQUEST_CPU,
                                                   programa);

                AdicionarEvento(proximoEvento);
            }

            Log(evento, "RequestCM", resultado);
            return(true);
        }
コード例 #32
0
        public FormSchemaConfig(CM.DataModel.Schemas.XsdDataBaseDesign nData)
        {
            InitializeComponent();

            DataBaseDataSet = nData;
            SchemaDataGridView.DataSource = DataBaseDataSet;

            DataBaseDataSet.TBL_Schema.AcceptChanges();
        }
コード例 #33
0
 public ContentManager Get(CM name)
 {
   SharedContentManager sharedContentManager;
   if (!this.temporary.TryGetValue(name, out sharedContentManager))
   {
     this.temporary.Add(name, sharedContentManager = new SharedContentManager(((object) name).ToString()));
     sharedContentManager.RootDirectory = this.global.RootDirectory;
   }
   return (ContentManager) sharedContentManager;
 }
コード例 #34
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(CM.Model.Advertisement model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into Advertisement(");
            strSql.Append("AName,AUrl,AImg,Status,CreateDate)");

            strSql.Append(" values (");
            strSql.Append("@AName,@AUrl,@AImg,@Status,@CreateDate)");
            strSql.Append(";select @@IDENTITY");
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "AName", DbType.String, model.AName);
            db.AddInParameter(dbCommand, "AUrl", DbType.String, model.AUrl);
            db.AddInParameter(dbCommand, "AImg", DbType.String, model.AImg);
            db.AddInParameter(dbCommand, "Status", DbType.Int16, model.Status);
            db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, model.CreateDate);
            int result;
            object obj = db.ExecuteScalar(dbCommand);
            if(!int.TryParse(obj.ToString(),out result))
            {
                return 0;
            }
            return result;
        }
コード例 #35
0
 public void Dispose(CM name)
 {
   SharedContentManager sharedContentManager;
   if (!this.temporary.TryGetValue(name, out sharedContentManager))
     return;
   sharedContentManager.Dispose();
   this.temporary.Remove(name);
 }
コード例 #36
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(CM.Model.Advertisement model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("update Advertisement set ");
            strSql.Append("AName=@AName,");
            strSql.Append("AUrl=@AUrl,");
            strSql.Append("AImg=@AImg,");
            strSql.Append("Status=@Status,");
            strSql.Append("CreateDate=@CreateDate");
            strSql.Append(" where AID=@AID ");
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "AID", DbType.Int32, model.AID);
            db.AddInParameter(dbCommand, "AName", DbType.String, model.AName);
            db.AddInParameter(dbCommand, "AUrl", DbType.String, model.AUrl);
            db.AddInParameter(dbCommand, "AImg", DbType.String, model.AImg);
            db.AddInParameter(dbCommand, "Status", DbType.Int16, model.Status);
            db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, model.CreateDate);
            int rows=db.ExecuteNonQuery(dbCommand);

            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
コード例 #37
0
 public SearchComponent(SM searchMode, object value, CM conditionMode)
 {
     this._searchmode = searchMode;
       this._value = value;
       this._conditionMode = conditionMode;
 }