Example #1
0
 public override void Render(float x, float y, float width, float height)
 {
     try
     {
         if (this.textImage != null)
         {
             this.UpdateTexture();
             if (this.isVisible)
             {
                 lock (textureLock)
                 {
                     if (this.texture != null)
                     {
                         GS.DrawSprite(texture, 0xFFFFFFFF, x, y, x + width, y + height);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         API.Instance.Log("Gw2Plugin: {0}", ex.ToString());
         Debug.BreakDebugger();
     }
 }
Example #2
0
        public CaseModel Func_GetValue_SetValue()
        {
            return(new CaseModel()
            {
                NameSign = @"获取/设置值",
                ExeEvent = () => {
                    GS answer = new GS()
                    {
                        Age = RandomData.GetInt(),
                        DateOfBirth = RandomData.GetDateTime(),
                        Name = RandomData.GetChineseString(),
                        Price = RandomData.GetDouble(),
                        Sex = RandomData.Item(EnumInfo.GetALLItem <GS.SexEnum>()),
                    };

                    GS result = new GS();

                    ShineUponParser parser = new ShineUponParser(typeof(GS));
                    foreach (ShineUponInfo info in parser.GetDictionary().Values)
                    {
                        KeyString ks = parser.GetValue_KeyString(info, answer);
                        parser.SetValue_Object(info, result, ks.Value);
                    }

                    return true;
                },
            });
        }
Example #3
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            //We must call StartFrame at the top of Update to indicate to the TimeRuler that a new frame has started.
            GS.StartFrame();
            GS.BeginMark("Update", FlatTheme.PeterRiver);

            //Some nice plots...
            //GS.Plot("FPS", _fpsCounter.Fps);
            //GS.Plot("Total Memory K", _memoryMonitor.TotalMemoryK, 240);
            //GS.Plot("Tick Memory K", _memoryMonitor.TickMemoryK);


            #if USE_GEARSET
            //Test for CPU / GPU bound
            if (GS.GearsetComponent.Console.Profiler.DoUpdate() == false)
            {
                GS.EndMark("Update");
                return;
            }
            #endif

            Thread.Sleep(1);//Let's trick the update into taking some time so that we can see some profile info

            base.Update(gameTime);
            GS.EndMark("Update");
        }
Example #4
0
    IEnumerator VillagerPhase()
    {
        VillageTile currentTile = gameBoard.getCurrentTile(this);

        string[]             options = new string[] { "Request help from " + currentTile.tilename, "Attempt Exorcism", "Pass" };
        string[]             buttons = new string[] { "A", "X", "B" };
        GSCoroutine <string> mcq     = io.getButtonPressDialog("What would you like to do?", options, buttons);

        yield return(mcq.coroutine);

        GS.displayInfoMessage(mcq.result);
        switch (mcq.result)
        {
        case "A":
            GS.displayInfoMessage(currentTile.tilename + " is busy, try again later.");
            break;

        case "X":
            yield return(StartCoroutine(gameBoard.attemptExorcism(this)));

            break;

        case "B":
            GS.displayInfoMessage("Passing turn");
            break;
        }
        yield return(new WaitForSeconds(1f));
    }
Example #5
0
    IEnumerator MovePhase()
    {
        GS.displayInfoMessage(displayName() + " has entered the move phase.");
        gameBoard.getPossibleMoves(this);
        while (true)
        {
            io.startHoverInfo();
            GSCoroutine <GameObject> clickedGSC = io.getClickedGameObject("_VillageTile");
            yield return(clickedGSC.coroutine);

            while (clickedGSC.result == null)
            {
                yield return(null);
            }
            GridSpace   targetgs = clickedGSC.result.GetComponent <GridSpace>();
            VillageTile vt       = targetgs.VillageTile;
            string      target   = vt.tilename;


            if (gameBoard.movePlayer(this, target))
            {
                GS.displayInfoMessage(displayName() + " is moving to " + target);
                break;
            }
            else
            {
                GS.displayWarnMessage(displayName() + " cannot go there");
            }

            yield return(null);
        }
        GS.displayInfoMessage(displayName() + " has finished the move phase.");
    }
Example #6
0
    /// <summary>
    /// Returns a list of RimStreetLines that have a StreetLine that has at least one end on the rim of the city circle, sorted by where that end is on the circle in terms of the angle it forms with the center, clockwise.
    /// <para>Lines that have both ends on the rim (very rare, only possible in low counts of street lines) are duplicated and in 2 different spots in the sort to reflect positions of both of their ends.</para>
    /// </summary>
    public static List <RimStreetLine> ExtractRimStreetLines(List <StreetLine> lines)
    {
        List <RimStreetLine> result = new List <RimStreetLine>();
        List <RimStreetLine> duplicatesToBeInserted = new List <RimStreetLine>();

        for (int i = 0; i < lines.Count; i++)
        {
            if (lines[i].AOnRim || lines[i].BOnRim)
            {
                result.Add(new RimStreetLine(lines[i]));
            }
            if (lines[i].AOnRim && lines[i].BOnRim)
            {
                duplicatesToBeInserted.Add(new RimStreetLine(lines[i], false));
            }
        }
        result.Sort((x, y) => (x.AngularPosOnRim < y.AngularPosOnRim ? -1 : 1));

        for (int i = 0; i < duplicatesToBeInserted.Count; i++)
        {
            for (int o = 0; o < result.Count; o++)
            {
                float anglePrev = result[GS.TrueMod(o - 1, result.Count)].AngularPosOnRim;
                float angleCurr = result[o].AngularPosOnRim;
                if (duplicatesToBeInserted[i].AngularPosOnRim >= anglePrev && duplicatesToBeInserted[i].AngularPosOnRim <= angleCurr)
                {
                    result.Insert(o, duplicatesToBeInserted[i]);
                    break;
                }
            }
        }
        DB.Log($"Extracted {result.Count} RimStreetLines");
        return(result);
    }
Example #7
0
        private void ClearBackground(uint cx, uint cy)
        {
            GSEffect solid = Obs.GetSolidEffect();

            solid.SetParameterValue("color", new Vector4(0.0f, 0.0f, 0.0f, 1.0f));

            GSEffectTechnique tech = solid.GetTechnique("Solid");

            GS.TechniqueBegin(tech);
            GS.TechniqueBeginPass(tech, 0);

            GS.MatrixPush();
            GS.MatrixIdentity();
            GS.MatrixScale3f((float)cx, (float)cy, 1.0f);

            GS.LoadVertexBuffer(boxPrimitive);

            //draw solid black color over the scene
            GS.Draw(GSDrawMode.TrisStrip, 0, 0);

            GS.MatrixPop();

            GS.TechniqueEndPass(tech);
            GS.TechniqueEnd(tech);

            GS.LoadVertexBuffer(null);
        }
Example #8
0
    Vector2 GetDirection(Vector2 start, StreetLine toAvoid)
    {
        //this version doesn't check for heading to Vector2.zero,
        //because it has to check for toAvoid
        if (GS.RChance(diagonalChance))
        {
            Vector2 result = diags.RandomElement();
            while (Mathf.Abs(Vector2.Dot(result, (toAvoid.A - toAvoid.B).normalized)) > 0.5)
            {
                result = diags.RandomElement();
            }
            return(result);
        }

        List <Vector2> options = new List <Vector2>();

        for (int i = 0; i < GS.CardinalDirs.Count; i++)
        {
            float dot = (toAvoid != null) ? Vector2.Dot(GS.CardinalDirs[i], (toAvoid.B - toAvoid.A).normalized) : 0;
            if (Mathf.Abs(dot) < 0.1f)
            {
                options.Add(GS.CardinalDirs[i]);
            }
        }
        return(options.RandomElement());
    }
Example #9
0
 void HandlePlayModeStateChanged(PlayModeStateChange state)
 {
     if (state == PlayModeStateChange.ExitingPlayMode)
     {
         GS.Disconnect();
     }
 }
Example #10
0
    private void Start()
    {
        GS        = Instantiate(GameSoundObject, new Vector3(0f, 0f, 0f), Quaternion.identity);
        GameAudio = GS.GetComponent <AudioSource>();
        DontDestroyOnLoad(GS);
        if (PlayerPrefs.GetInt("MUSIC", 1) == 1)
        {
            MusicToggle.TurnOn();
            GameAudio.Play();
        }
        else
        {
            MusicToggle.TurnOff();
            GameAudio.Stop();
        }

        string quality = PlayerPrefs.GetString("QS", "High");

        string[] names = QualitySettings.names;
        Debug.Log(quality);
        for (int i = 0; i < names.Length; i++)
        {
            if (names[i] == quality)
            {
                RadioButtons[i].GetComponent <LeanToggle>().TurnOn();
                RadioButtons[i].GetComponent <LeanButton>().interactable = false;
                QualitySettings.SetQualityLevel(i, true);
            }
        }
    }
Example #11
0
            public static int Update(Client c)
            {
                if (c.ID == 0)
                {
                    return(1);//// 1= Client Id Is not set
                }
                string q = string.Format(@"UPDATE `personals` SET 
                                            `name` = '{0}',
                                            `nickName` = '{1}',
                                            `CompanyName` = '{2}',
                                            `phone` = '{3}',
                                            `mobile` = '{4}',
                                            `CompanyPhone` = '{5}',
                                            `Fax` = '{6}',
                                            `address` = '{7}',
                                            `type` = '{8}',
                                            `CompanyAddress` = '{9}'
                                            WHERE `personals`.`id` = '{10}';",
                                         GS.SafeFarsiStr(c.name),
                                         GS.SafeFarsiStr(c.nickName),
                                         GS.SafeFarsiStr(c.CompanyName),
                                         c.phone, c.mobile,
                                         c.CompanyPhone, c.Fax,
                                         GS.SafeFarsiStr(c.Address),
                                         (int)c.type,
                                         GS.SafeFarsiStr(c.CompanyAddress),
                                         c.ID);
                DataTable dtUpdate = GS.db.Query(q);

                return(0);//// All Job is completed successfuly
            }
Example #12
0
    // Use this for initialization
    public void Awake()
    {
        if (s != null && s != this)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            s = this;
        }

        for (int i = 0; i < allModes.Length; i++)
        {
            if (allModes[i] != null)
            {
                allModes[i].id = i;
            }
        }


        ChangeGameMode(defaultMode);

#if UNITY_EDITOR
        if (isDebug)
        {
            ChangeGameMode(debugMode);
            isDebug = false;
        }

        //print (NextLevelInChain ());
#endif

        GetComponent <SceneMaster> ()._OnLevelWasLoaded += LevelWasLoaded;
    }
Example #13
0
    public void exitToMainMenu()
    {
        Debug.Log("exiting to main");
        PhotonNetwork.LeaveRoom();
        for (int i = 0; i < dontDestroyObjects.Length; i++)
        {
            if (dontDestroyObjects[i].tag.Equals("gsh"))
            {
                dontDestroyObjects[i].GetComponent <GameSparksHandler>().destroyMe();
            }
            else
            {
                Destroy(dontDestroyObjects[i]);
            }
        }
        destroyed = true;
        //GS.Reset();
        GS.Disconnect();
        PhotonNetwork.Disconnect();
        SceneManager.LoadScene(0);
        PhotonNetwork.Destroy(gameObject);


        //PhotonNetwork.Destroy(gameObject.GetComponent<PhotonView>());

        //PhotonNetwork.LoadLevel(0);
        //numAIPlayers = 0;
        //resetSceneStillConnected.Invoke();
        //hostOfRoom = false;
        //gameBegun = false;
        //inRoom = false;
    }
Example #14
0
 public void LogOut()
 {
     lock (thisLock)
     {
         GS.Reset();
     }
 }
Example #15
0
 public bool IsGSEqual(GS m1, GS m2)
 {
     if (m1.Age != m2.Age)
     {
         Console.WriteLine("不相等:  m1.Age:{0}  m2.Age:{1}", m1.Age, m2.Age);
         return(false);
     }
     if (m1.DateOfBirth != m2.DateOfBirth)
     {
         Console.WriteLine("不相等:  m1.DateOfBirth:{0}  m2.DateOfBirth:{1}", m1.DateOfBirth, m2.DateOfBirth);
         return(false);
     }
     if (m1.Name != m2.Name)
     {
         Console.WriteLine("不相等:  m1.Name:{0}  m2.Name:{1}", m1.Name, m2.Name);
         return(false);
     }
     if (m1.Price != m2.Price)
     {
         Console.WriteLine("不相等:  m1.Price:{0}  m2.Price:{1}", m1.Price, m2.Price);
         return(false);
     }
     if (m1.Sex != m2.Sex)
     {
         Console.WriteLine("不相等:  m1.Sex:{0}  m2.Sex:{1}", m1.Sex, m2.Sex);
         return(false);
     }
     return(true);
 }
Example #16
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(new Color(48, 48, 48, 255));

            GS.BeginMark("Draw", FlatTheme.Pomegrantate);

            GS.BeginMark("Draw Background", FlatTheme.Pumpkin);
            Thread.Sleep(2); //Let's trick the update into taking some time so that we can see some profile info
            GS.EndMark("Draw Background");

            //Test nesting
            GS.BeginMark("Draw Sprites", FlatTheme.Sunflower);
            Thread.Sleep(1); //Let's trick the update into taking some time so that we can see some profile info
            GS.BeginMark("Draw Sprites", FlatTheme.Sunflower);
            Thread.Sleep(1); //Let's trick the update into taking some time so that we can see some profile info
            GS.EndMark("Draw Sprites");
            GS.EndMark("Draw Sprites");

            GS.BeginMark("Draw Particles", FlatTheme.Amethyst);
            Thread.Sleep(2); //Let's trick the update into taking some time so that we can see some profile info
            GS.EndMark("Draw Particles");

            GS.BeginMark("base.Draw", FlatTheme.Nephritis);
            base.Draw(gameTime);
            GS.EndMark("base.Draw");

            GS.EndMark("Draw");
        }
Example #17
0
 public void LoginWithFB(string accessToken)
 {
     new FacebookConnectRequest().SetSwitchIfPossible(true).SetAccessToken(accessToken).Send((response) => {
         if (!response.HasErrors)
         {
             MoveLayer.THIS.Name = response.DisplayName.ToString();//
             GetButtonFB.gameObject.SetActive(false);
             PortalNetwork.THIS.UserID = response.UserId;
             GetPicture(AccessToken.CurrentAccessToken.TokenString); Tournament.joined = true; Tournament.tournament.MenuTounamentClick();
         }
         else
         {
             IDictionary <string, object> errors = response.Errors.BaseData;
             Debug.Log("Authentification error:");
             foreach (var item in errors)
             {
                 if (item.Key == "error" && item.Value.ToString() == "timeout")
                 {
                     if (GS.Available)
                     {
                         GS.Reset();
                     }
                 }
             }
         }
     });
 }
Example #18
0
        virtual protected void Start()
        {
            DeviceName = SystemInfo.deviceName.ToString();
            DeviceType = SystemInfo.deviceType.ToString();
#if UNITY_ANDROID && !UNITY_EDITOR
            //alternative way to retrieve unique ID without requiring READ_PHONE_STATE permission
            AndroidJavaClass  androidUnityPlayer    = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            AndroidJavaObject unityPlayerActivity   = androidUnityPlayer.GetStatic <AndroidJavaObject>("currentActivity");
            AndroidJavaObject unityPlayerResolver   = unityPlayerActivity.Call <AndroidJavaObject>("getContentResolver");
            AndroidJavaClass  androidSettingsSecure = new AndroidJavaClass("android.provider.Settings$Secure");
            DeviceId = androidSettingsSecure.CallStatic <string>("getString", unityPlayerResolver, "android_id");
#else
            DeviceId = SystemInfo.deviceUniqueIdentifier.ToString();
#endif
#if !GS_DONT_USE_PLAYER_PREFS
            AuthToken = PlayerPrefs.GetString(PLAYER_PREF_AUTHTOKEN_KEY);
            UserId    = PlayerPrefs.GetString(PLAYER_PREF_USERID_KEY);
#endif
            Platform         = Application.platform.ToString();
            ExtraDebug       = GameSparksSettings.DebugBuild;
            ServiceUrl       = GameSparksSettings.ServiceUrl;
            GameSparksSecret = GameSparksSettings.ApiSecret;
#if !UNITY_WEBPLAYER
            PersistentDataPath = Application.persistentDataPath;
#endif
            RequestTimeoutSeconds = 10;

            GS.Initialise(this);

            DontDestroyOnLoad(this);
        }
 void FriendPlayReqResp(JSONObject e)
 {
     if (SceneManager.GetActiveScene().name.Equals("Menu"))
     {
         GS.Inst.FPRR_ID = GS.GetTrimmed(e.GetField("data").GetField("comp").GetField("_id"));
         if (!string.IsNullOrEmpty(GS.Inst.BFRR_ID))
         {
             if (!GS.Inst.FPRR_ID.Equals(GS.Inst.BFRR_ID))
             {
                 GS.Inst.gameMode = (GameMode)int.Parse(GS.GetTrimmed(e.GetField("data").GetField("gt")));
                 FrndReqAlertBox.Inst.ShowAlert(e.GetField("data"));
                 if (TossSelectionPool.Inst.transform.localScale.x > 0)
                 {
                     TossSelectionPool.Inst.ShowWaitingProcessBlank();
                 }
             }
             GS.Inst.BFRR_ID = "";
         }
         else
         {
             GS.Inst.gameMode = (GameMode)int.Parse(GS.GetTrimmed(e.GetField("data").GetField("gt")));
             FrndReqAlertBox.Inst.ShowAlert(e.GetField("data"));
             if (TossSelectionPool.Inst.transform.localScale.x > 0)
             {
                 TossSelectionPool.Inst.ShowWaitingProcessBlank();
             }
         }
     }
     else
     {
         NotificationAlert.Inst.GenerateAlert(e, AlertType.PlayReq);
     }
 }
Example #20
0
        public static void OnUse(GS.Players.Player player, Item salvageItem)
        {           
            if (salvageItem == null) return;
            player.Inventory.DestroyInventoryItem(salvageItem);

            List<Item> craftingMaterials = TreasureClassManager.CreateLoot(player, salvageItem.ItemDefinition.SNOComponentTreasureClass);
            if (salvageItem.Attributes[GameAttribute.Item_Quality_Level] >= (int)ItemTable.ItemQuality.Magic1)
                craftingMaterials.AddRange(TreasureClassManager.CreateLoot(player, salvageItem.ItemDefinition.SNOComponentTreasureClassMagic));
            if (salvageItem.Attributes[GameAttribute.Item_Quality_Level] >= (int)ItemTable.ItemQuality.Rare4)
                craftingMaterials.AddRange(TreasureClassManager.CreateLoot(player, salvageItem.ItemDefinition.SNOComponentTreasureClassRare));

            List<int> craftigItemsGbids = new List<int>();
            foreach (Item crafingItem in craftingMaterials)
            {
                craftigItemsGbids.Add(crafingItem.GBHandle.GBID);
                // reveal new item to player                  
                player.Inventory.PickUp(crafingItem);
            }

            // TODO: This Message doesn't work. I think i should produce an entry in the chat window like "Salvaging Gloves gave you Common scrap!" - angerwin
            SalvageResultsMessage message = new SalvageResultsMessage
            {
                gbidNewItems = craftigItemsGbids.ToArray(),
                gbidOriginalItem = salvageItem.GBHandle.GBID,
                Field1 = 0, // Unkown
                Field2 = 0, // Unkown 

            };
            //_owner.InGameClient.SendMessage(message);
        }
Example #21
0
        private void InitPrimitives()
        {
            using (GS.GraphicsContext())
            {
                // box from vertices
                boxPrimitive = new GSVertexBuffer();
                using (GS.RenderVertexBuffer(boxPrimitive))
                {
                    GS.Vertex2f(0.0f, 0.0f);
                    GS.Vertex2f(0.0f, 1.0f);
                    GS.Vertex2f(1.0f, 1.0f);
                    GS.Vertex2f(1.0f, 1.0f);
                    GS.Vertex2f(1.0f, 0.0f);
                    GS.Vertex2f(0.0f, 0.0f);
                }

                // circle from vertices
                circlePrimitive = new GSVertexBuffer();
                using (GS.RenderVertexBuffer(circlePrimitive))
                {
                    for (int i = 0; i <= 360; i += 360 / 20)
                    {
                        double pos = Math.PI * (double)i / 180.0;
                        GS.Vertex2f((float)Math.Cos(pos), (float)Math.Sin(pos));
                    }
                }
            }
        }
Example #22
0
        public static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Error("The file to run is the one and only file that should be passed as an argument.");
            }

            if (args[0].StartsWith("-"))
            {
                Error("Invalid filename. Cannot start with \"-\".");
            }

            string code = "";

            try
            {
                code = System.IO.File.ReadAllText(args[0]);
            }
            catch (FileNotFoundException)
            {
                Error("The file you specified does not exist.");
            }

            LoadAssemblies();

            // TODO: add other options to commandline arguments
            ParsingApi.SetDialect(new DefaultDialect());

            Api.Program p = GS.CreateProgram(code);
            GS.Run(p);
        }
Example #23
0
 public void Logout()
 {
     GS.Reset();
     uiManager.SetLoggedInAnonymously(true);
     // TODO: clear player data.
     InitUser();
 }
Example #24
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            //Exit the game when pressing escape
            if (Input.WasKeyPressed(Keys.Escape))
            {
                Exit();
            }

            _screenManager.Update(gameTime, _isActive);

            //BEPU Physics
            if (GameSettings.p_Physics)
            {
                _physicsSpace.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
            }

            base.Update(gameTime);

            const string mark = "Update";


            GS.StartFrame();
            GS.BeginMark(mark, FlatTheme.PeterRiver);
            //GS.Plot("FPS", (float) GameStats.fps_avg, 100);

#if USE_GEARSET
            if (GS.GearsetComponent.Console.Profiler.DoUpdate() == false)
            {
                return;
            }
#endif

            GS.EndMark(mark);
        }
        private void LoadTexture(String imageFile)
        {
            lock (textureLock) {
                if (mCardTexture != null)
                {
                    mCardTexture.Dispose();
                    mCardTexture = null;
                }

                if (File.Exists(imageFile))
                {
                    BitmapImage src = new BitmapImage();

                    src.BeginInit();
                    src.UriSource = new Uri(imageFile);
                    src.EndInit();

                    WriteableBitmap wb = new WriteableBitmap(src);

                    mCardTexture = GS.CreateTexture((UInt32)wb.PixelWidth, (UInt32)wb.PixelHeight,
                                                    GSColorFormat.GS_BGRA, null, false, false);

                    mCardTexture.SetImage(wb.BackBuffer, GSImageFormat.GS_IMAGEFORMAT_BGRA,
                                          (UInt32)(wb.PixelWidth * 4));
                }
                else
                {
                    mCardTexture = null;
                }
            }
        }
Example #26
0
    public Mesh BuildMesh()
    {
        Mesh           m     = new Mesh();
        List <Vector3> verts = new List <Vector3>(corners3D.Count + 1);

        for (int i = 0; i < corners3D.Count; i++)
        {
            verts.Add(corners3D[i] - Center3D);
        }
        verts.Add(Vector3.zero);
        List <int> tris = new List <int>();

        for (int i = 0; i < verts.Count - 1; i++)
        {
            tris.Add(i);
            tris.Add(GS.TrueMod(i + 1, verts.Count - 1));
            tris.Add(verts.Count - 1);
        }
        m.vertices  = verts.ToArray();
        m.triangles = tris.ToArray();
        m.RecalculateBounds();
        m.RecalculateNormals();
        m.RecalculateTangents();
        m.Subdivide((Area > 3000) ? 9 : 4);
        return(m);
    }
Example #27
0
    public System.Collections.IEnumerator ChangeScreenAndSave(GS type)
    {
        GameObject g = Instantiate(universalPrefab, new Vector3(3.28f, 1.7f), Quaternion.identity) as GameObject;

        g.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>(SpritePaths.Saving);
        g.renderer.sortingLayerName = "Pause HUD Cursor";
        for (int i = 0; i < 10; i++)
        {
            if (g == null)
            {
                break;
            }
            g.transform.Rotate(0.0f, 0.0f, -3.0f);
            yield return(new WaitForSeconds(0.01f));
        }
        SaveGeemu();
        for (int i = 0; i < 10; i++)
        {
            if (g == null)
            {
                break;
            }
            g.transform.Rotate(0.0f, 0.0f, -3.0f);
            yield return(new WaitForSeconds(0.01f));
        }
        if (g != null)
        {
            Destroy(g);
        }
        ChangeScreen(type);
    }
Example #28
0
    StreetTraversal PickNextTraversed(Intersection currentIntersection, StreetTraversal prevTraversed)
    {
        //the float as the key doesnt pose issues because the only way we access anyway is by MaxKey
        Dictionary <float, StreetTraversal> streetsByAngle = new Dictionary <float, StreetTraversal>();

        //picking connected Streets that go counterclockwise, or straight, compared to prevTraversed
        foreach (Street connected in currentIntersection.Connected)
        {
            if (connected == prevTraversed.Street)
            {
                continue;
            }                                                    //we dont want to backtrack, so skipping the one from which we came from
            Vector2 prevDir           = GS.GetPolar(prevTraversed.FromAToB) * prevTraversed.Street.Line.Dir;
            bool    connectedFromAToB = (currentIntersection == connected.InterA);
            Vector2 connectedDir      = GS.GetPolar(connectedFromAToB) * connected.Line.Dir;
            float   angle             = -Vector2.SignedAngle(prevDir, connectedDir);
            if (angle >= -0.01f)
            {
                streetsByAngle.Add(angle, new StreetTraversal(connected, connectedFromAToB));
            }
        }
        if (streetsByAngle.Count > 0)
        {
            return(streetsByAngle[streetsByAngle.MaxKey()]);
        }
        return(null);
    }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(GS.Model.major model)
 {
     StringBuilder strSql=new StringBuilder();
     StringBuilder strSql1=new StringBuilder();
     StringBuilder strSql2=new StringBuilder();
     if (model.id != null)
     {
         strSql1.Append("id,");
         strSql2.Append("'"+model.id+"',");
     }
     if (model.name != null)
     {
         strSql1.Append("name,");
         strSql2.Append("'"+model.name+"',");
     }
     strSql.Append("insert into major(");
     strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
     strSql.Append(")");
     strSql.Append(" values (");
     strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
     strSql.Append(")");
     int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
     if (rows > 0)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Example #30
0
    public Vector2 GetRandomWallLengths(float squaringChance)
    {
        Vector2 lengths = new Vector2(GetRandomWallLength(), 0);

        lengths.y = (GS.RChance(squaringChance)) ? lengths.x : GetRandomWallLength(lengths.x);
        return(lengths);
    }
        override public void UpdateSettings()
        {
            UInt32 width  = (UInt32)config.GetInt("width", 640);
            UInt32 height = (UInt32)config.GetInt("height", 480);

            Size.X = width;
            Size.Y = height;

            config.Parent.SetInt("cx", (Int32)width);
            config.Parent.SetInt("cy", (Int32)height);

            lock (textureLock)
            {
                if (texture != null)
                {
                    texture.Dispose();
                    texture = null;
                }

                texture = GS.CreateTexture(width, height, GSColorFormat.GS_BGRA, null, false, false);
            }

            if (overlayHook == null)
            {
                overlayHook = new OverlayHook();
                overlayHook.Start(width, height);
            }
            else
            {
                overlayHook.UpdateSize(width, height);
            }
        }
Example #32
0
        private void RenderItem(IntPtr data, uint cx, uint cy)
        {
            bool sourceIsInitialized = _source.Width != 0 || _source.Height != 0;

            if (!sourceIsInitialized)
            {
                if (_loadingMessage == null)
                {
                    Store.Data.Webcam.Window.Dispatcher.Invoke(new Action(AddLoadingMessage));
                }
            }
            else
            {
                if (_loadingMessage != null)
                {
                    Store.Data.Webcam.Window.Dispatcher.Invoke(new Action(RemoveLoadingMessage));
                }
            }

            int   newW             = (int)cx;
            int   newH             = (int)cy;
            int   itemWidth        = (int)_item.Width;
            int   itemHeight       = (int)_item.Height;
            int   itemSourceWidth  = (int)_source.Width;
            int   itemSourceHeight = (int)_source.Height;
            float previewAspect    = (float)cx / cy;
            float itemAspect       = (float)itemWidth / itemHeight;
            float sourceAspect     = (float)itemSourceWidth / itemSourceHeight;

            //calculate new width and height for item to make it fit inside the preview area
            if (previewAspect > itemAspect)
            {
                newW = (int)(cy * itemAspect);
            }
            else
            {
                newH = (int)(cx / itemAspect);
            }

            int centerX = ((int)cx - newW) / 2;
            int centerY = ((int)cy - newH) / 2;

            GS.ViewportPush();
            GS.ProjectionPush();

            float difWidth  = itemAspect < sourceAspect ? (itemSourceWidth - (itemSourceHeight * itemAspect)) / 2.0f : 0.0f;
            float difHeight = itemAspect < sourceAspect ? 0.0f : (itemSourceHeight - (itemSourceWidth / itemAspect)) / 2.0f;

            //setup orthographic projection of the item
            GS.Ortho(difWidth, itemSourceWidth - difWidth, difHeight, itemSourceHeight - difHeight, -100.0f, 100.0f);
            GS.SetViewport(centerX, centerY, newW, newH);

            //render item content
            _source.Render();

            GS.ProjectionPop();
            GS.ViewportPop();

            GS.LoadVertexBuffer(null);
        }
Example #33
0
        public static void OnUse(GS.Players.Player player, Item sellItem)
        {
            int sellValue = sellItem.ItemDefinition.BaseGoldValue; // TODO: calculate correct sell value for magic items
            player.Inventory.AddGoldAmount(sellValue);

            // TODO: instead of destroying item, it should be moved to merchants inventory for rebuy. 
            player.Inventory.DestroyInventoryItem(sellItem);
        }
Example #34
0
        public override void OnRequestUse(GS.Players.Player player, Item target, int actionId, Net.GS.Message.Fields.WorldPlace worldPlace)
        {
            if (player.Attributes[GameAttribute.Hitpoints_Cur] == player.Attributes[GameAttribute.Hitpoints_Max])
                return; // TODO Error msg? /fasbat
            player.Attributes[GameAttribute.Hitpoints_Cur] =
                Math.Min(player.Attributes[GameAttribute.Hitpoints_Cur] + this.Attributes[GameAttribute.Hitpoints_Granted],
                player.Attributes[GameAttribute.Hitpoints_Max]);
            player.Attributes.SendChangedMessage(player.InGameClient, player.DynamicID); // TODO Send to all. /fasbat

            if (this.Attributes[GameAttribute.ItemStackQuantityLo] <= 1)
                player.Inventory.DestroyInventoryItem(this); // No more potions!
            else
            {
                this.Attributes[GameAttribute.ItemStackQuantityLo]--; // Just remove one
                this.Attributes.SendChangedMessage(player.InGameClient, this.DynamicID);
            }

        }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(GS.Model.examrecord model)
 {
     StringBuilder strSql = new StringBuilder();
     StringBuilder strSql1 = new StringBuilder();
     StringBuilder strSql2 = new StringBuilder();
     if (model.student != null)
     {
         strSql1.Append("student,");
         strSql2.Append("'" + model.student + "',");
     }
     if (model.classId != null)
     {
         strSql1.Append("class,");
         strSql2.Append("" + model.classId + ",");
     }
     if (model.score != null)
     {
         strSql1.Append("score,");
         strSql2.Append("" + model.score + ",");
     }
     if (model.remark != null)
     {
         strSql1.Append("remark,");
         strSql2.Append("'" + model.remark + "',");
     }
     strSql.Append("insert into examRecord(");
     strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
     strSql.Append(")");
     strSql.Append(" values (");
     strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
     strSql.Append(")");
     strSql.Append(";select @@IDENTITY");
     object obj = DbHelperSQL.GetSingle(strSql.ToString());
     if (obj == null)
     {
         return 0;
     }
     else
     {
         return Convert.ToInt64(obj);
     }
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(GS.Model.administrator model)
 {
     StringBuilder strSql=new StringBuilder();
     StringBuilder strSql1=new StringBuilder();
     StringBuilder strSql2=new StringBuilder();
     if (model.userName != null)
     {
         strSql1.Append("userName,");
         strSql2.Append("'"+model.userName+"',");
     }
     if (model.passWord != null)
     {
         strSql1.Append("passWord,");
         strSql2.Append("'"+model.passWord+"',");
     }
     if(model.type!=null)
     {
         strSql1.Append("type,");
         strSql2.Append("'"+model.type+"',");
     }
     strSql.Append("insert into administrator(");
     strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
     strSql.Append(")");
     strSql.Append(" values (");
     strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
     strSql.Append(")");
     strSql.Append(";select @@IDENTITY");
     object obj = DbHelperSQL.GetSingle(strSql.ToString());
     if (obj == null)
     {
         return 0;
     }
     else
     {
         return Convert.ToInt32(obj);
     }
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(GS.Model.studentloginlog model)
 {
     StringBuilder strSql=new StringBuilder();
     StringBuilder strSql1=new StringBuilder();
     StringBuilder strSql2=new StringBuilder();
     if (model.student != null)
     {
         strSql1.Append("student,");
         strSql2.Append("'"+model.student+"',");
     }
     if (model.time != null)
     {
         strSql1.Append("time,");
         strSql2.Append("'"+model.time+"',");
     }
     if (model.ip != null)
     {
         strSql1.Append("ip,");
         strSql2.Append("'"+model.ip+"',");
     }
     strSql.Append("insert into studentLoginLog(");
     strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
     strSql.Append(")");
     strSql.Append(" values (");
     strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
     strSql.Append(")");
     strSql.Append(";select @@IDENTITY");
     object obj = DbHelperSQL.GetSingle(strSql.ToString());
     if (obj == null)
     {
         return 0;
     }
     else
     {
         return Convert.ToInt64(obj);
     }
 }
Example #38
0
        public Item(GS.Map.World world, ItemTable definition)
            : base(world, definition.SNOActor)
        {
            this.ItemDefinition = definition;

            this.GBHandle.Type = (int)GBHandleType.Gizmo;
            this.GBHandle.GBID = definition.Hash;
            this.ItemType = ItemGroup.FromHash(definition.ItemType1);
            this.EquipmentSlot = 0;
            this.InventoryLocation = new Vector2D { X = 0, Y = 0 };
            this.Scale = 1.0f;
            this.RotationAmount = 0.0f;
            this.RotationAxis.Set(0.0f, 0.0f, 1.0f);

            this.Field2 = 0x00000000;
            this.Field3 = 0x00000000;
            this.Field7 = 0;
            this.Field8 = 0;
            this.Field9 = 0x00000000;
            this.Field10 = 0x00;

            this.ItemLevel = definition.ItemLevel;

            // level requirement
            // Attributes[GameAttribute.Requirement, 38] = definition.RequiredLevel;

            Attributes[GameAttribute.Item_Quality_Level] = 1;
            if (Item.IsArmor(this.ItemType) || Item.IsWeapon(this.ItemType)|| Item.IsOffhand(this.ItemType))
                Attributes[GameAttribute.Item_Quality_Level] = RandomHelper.Next(6);
            if(this.ItemType.Flags.HasFlag(ItemFlags.AtLeastMagical) && Attributes[GameAttribute.Item_Quality_Level] < 3)
                Attributes[GameAttribute.Item_Quality_Level] = 3;

            Attributes[GameAttribute.Seed] = RandomHelper.Next(); //unchecked((int)2286800181);

            /*
            List<IItemAttributeCreator> attributeCreators = new AttributeCreatorFactory().Create(this.ItemType);
            foreach (IItemAttributeCreator creator in attributeCreators)
            {
                creator.CreateAttributes(this);
            }
            */

            RandomGenerator = new ItemRandomHelper(Attributes[GameAttribute.Seed]);
            RandomGenerator.Next();
            if (Item.IsArmor(this.ItemType))
                RandomGenerator.Next(); // next value is used but unknown if armor
            RandomGenerator.ReinitSeed();

            ApplyWeaponSpecificOptions(definition);
            ApplyArmorSpecificOptions(definition);
            ApplyDurability(definition);
            ApplySkills(definition);
            ApplyAttributeSpecifier(definition);

            int affixNumber = 1;
            if (Attributes[GameAttribute.Item_Quality_Level] >= 3)
                affixNumber = Attributes[GameAttribute.Item_Quality_Level] - 2;
            AffixGenerator.Generate(this, affixNumber);
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(GS.Model.studentloginlog model)
 {
     StringBuilder strSql=new StringBuilder();
     strSql.Append("update studentLoginLog set ");
     if (model.student != null)
     {
         strSql.Append("student='"+model.student+"',");
     }
     if (model.time != null)
     {
         strSql.Append("time='"+model.time+"',");
     }
     if (model.ip != null)
     {
         strSql.Append("ip='"+model.ip+"',");
     }
     int n = strSql.ToString().LastIndexOf(",");
     strSql.Remove(n, 1);
     strSql.Append(" where id="+ model.id+"");
     int rowsAffected=DbHelperSQL.ExecuteSql(strSql.ToString());
     if (rowsAffected > 0)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(GS.Model.classdetail model)
 {
     return dal.Update(model);
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(GS.Model.classtype model)
 {
     return dal.Update(model);
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(GS.Model.classdetail model)
 {
     StringBuilder strSql=new StringBuilder();
     strSql.Append("update classDetail set ");
     if (model.name != null)
     {
         strSql.Append("name='"+model.name+"',");
     }
     if (model.type != null)
     {
         strSql.Append("type='"+model.type+"',");
     }
     if (model.teacher != null)
     {
         strSql.Append("teacher='"+model.teacher+"',");
     }
     else
     {
         strSql.Append("teacher= null ,");
     }
     if (model.startTime != null)
     {
         strSql.Append("startTime='"+model.startTime+"',");
     }
     else
     {
         strSql.Append("startTime= null ,");
     }
     if (model.endTime != null)
     {
         strSql.Append("endTime='"+model.endTime+"',");
     }
     else
     {
         strSql.Append("endTime= null ,");
     }
     if (model.period != null)
     {
         strSql.Append("period="+model.period+",");
     }
     else
     {
         strSql.Append("period= null ,");
     }
     if (model.credit != null)
     {
         strSql.Append("credit="+model.credit+",");
     }
     else
     {
         strSql.Append("credit= null ,");
     }
     if (model.location != null)
     {
         strSql.Append("location='"+model.location+"',");
     }
     else
     {
         strSql.Append("location= null ,");
     }
     if (model.remark != null)
     {
         strSql.Append("remark='"+model.remark+"',");
     }
     else
     {
         strSql.Append("remark= null ,");
     }
     if (model.classId != null)
     {
         strSql.Append("classId='"+model.classId+"',");
     }
     else
     {
         strSql.Append("classId= null ,");
     }
     int n = strSql.ToString().LastIndexOf(",");
     strSql.Remove(n, 1);
     strSql.Append(" where id="+ model.id+"");
     int rowsAffected=DbHelperSQL.ExecuteSql(strSql.ToString());
     if (rowsAffected > 0)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Example #43
0
        public Item(GS.Map.World world, ItemTable definition)
            : base(world, definition.SNOActor)
        {
            this.ItemDefinition = definition;

            this.GBHandle.Type = (int)GBHandleType.Gizmo;
            this.GBHandle.GBID = definition.Hash;
            this.ItemType = ItemGroup.FromHash(definition.ItemType1);
            this.EquipmentSlot = 0;
            this.InventoryLocation = new Vector2D { X = 0, Y = 0 };
            this.Scale = 1.0f;
            this.FacingAngle = 0.0f;
            this.RotationAxis.Set(0.0f, 0.0f, 1.0f);
            this.CurrentState = ItemState.Normal;
            this.Field2 = 0x00000000;
            this.Field7 = 0;
            this.NameSNOId = -1;      // I think it is ignored anyways - farmy
            this.Field10 = 0x00;

            this.ItemLevel = definition.ItemLevel;

            // level requirement
            // Attributes[GameAttribute.Requirement, 38] = definition.RequiredLevel;

            Attributes[GameAttribute.Item_Quality_Level] = 1;
            if (Item.IsArmor(this.ItemType) || Item.IsWeapon(this.ItemType)|| Item.IsOffhand(this.ItemType))
                Attributes[GameAttribute.Item_Quality_Level] = RandomHelper.Next(6);
            if(this.ItemType.Flags.HasFlag(ItemFlags.AtLeastMagical) && Attributes[GameAttribute.Item_Quality_Level] < 3)
                Attributes[GameAttribute.Item_Quality_Level] = 3;

            Attributes[GameAttribute.ItemStackQuantityLo] = 1;
            Attributes[GameAttribute.Seed] = RandomHelper.Next(); //unchecked((int)2286800181);

            RandomGenerator = new ItemRandomHelper(Attributes[GameAttribute.Seed]);
            RandomGenerator.Next();
            if (Item.IsArmor(this.ItemType))
                RandomGenerator.Next(); // next value is used but unknown if armor
            RandomGenerator.ReinitSeed();

            ApplyWeaponSpecificOptions(definition);
            ApplyArmorSpecificOptions(definition);
            ApplyDurability(definition);
            ApplySkills(definition);
            ApplyAttributeSpecifier(definition);

            int affixNumber = 1;
            if (Attributes[GameAttribute.Item_Quality_Level] >= 3)
                affixNumber = Attributes[GameAttribute.Item_Quality_Level] - 2;
            AffixGenerator.Generate(this, affixNumber);
        }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(GS.Model.studentloginlog model)
 {
     return dal.Add(model);
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(GS.Model.studentloginlog model)
 {
     return dal.Update(model);
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(GS.Model.major model)
 {
     return dal.Add(model);
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(GS.Model.major model)
 {
     return dal.Update(model);
 }
Example #48
0
 public NephalemCube(GS.Map.World world, Mooege.Common.MPQ.FileFormats.ItemTable definition)
     : base(world, definition)
 {
 }
Example #49
0
 public StoneOfRecall(GS.Map.World world, Mooege.Common.MPQ.FileFormats.ItemTable definition)
     : base(world, definition)
 {
 }
Example #50
0
 public CauldronOfJordan(GS.Map.World world, Mooege.Common.MPQ.FileFormats.ItemTable definition)
     : base(world, definition)
 {
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(GS.Model.major model)
 {
     StringBuilder strSql=new StringBuilder();
     strSql.Append("update major set ");
     if (model.name != null)
     {
         strSql.Append("name='"+model.name+"',");
     }
     else
     {
         strSql.Append("name= null ,");
     }
     int n = strSql.ToString().LastIndexOf(",");
     strSql.Remove(n, 1);
     strSql.Append(" where id='"+ model.id+"' ");
     int rowsAffected=DbHelperSQL.ExecuteSql(strSql.ToString());
     if (rowsAffected > 0)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(GS.Model.student model)
 {
     StringBuilder strSql=new StringBuilder();
     strSql.Append("update student set ");
     if (model.name != null)
     {
         strSql.Append("name='"+model.name+"',");
     }
     if (model.sex != null)
     {
         strSql.Append("sex='"+model.sex+"',");
     }
     else
     {
         strSql.Append("sex= null ,");
     }
     if (model.majorId != null)
     {
         strSql.Append("majorId='"+model.majorId+"',");
     }
     else
     {
         strSql.Append("majorId= null ,");
     }
     if (model.majorName != null)
     {
         strSql.Append("majorName='"+model.majorName+"',");
     }
     else
     {
         strSql.Append("majorName= null ,");
     }
     if (model.colleage != null)
     {
         strSql.Append("colleage='"+model.colleage+"',");
     }
     else
     {
         strSql.Append("colleage= null ,");
     }
     if (model.classType != null)
     {
         strSql.Append("classType='"+model.classType+"',");
     }
     else
     {
         strSql.Append("classType= null ,");
     }
     if (model.nation != null)
     {
         strSql.Append("nation='"+model.nation+"',");
     }
     else
     {
         strSql.Append("nation= null ,");
     }
     if (model.birthday != null)
     {
         strSql.Append("birthday='"+model.birthday+"',");
     }
     else
     {
         strSql.Append("birthday= null ,");
     }
     if (model.certificateType != null)
     {
         strSql.Append("certificateType='"+model.certificateType+"',");
     }
     else
     {
         strSql.Append("certificateType= null ,");
     }
     if (model.certificateId != null)
     {
         strSql.Append("certificateId='"+model.certificateId+"',");
     }
     else
     {
         strSql.Append("certificateId= null ,");
     }
     if (model.degree != null)
     {
         strSql.Append("degree='"+model.degree+"',");
     }
     else
     {
         strSql.Append("degree= null ,");
     }
     if (model.placeOfWork != null)
     {
         strSql.Append("placeOfWork='"+model.placeOfWork+"',");
     }
     else
     {
         strSql.Append("placeOfWork= null ,");
     }
     if (model.workPhone != null)
     {
         strSql.Append("workPhone='"+model.workPhone+"',");
     }
     else
     {
         strSql.Append("workPhone= null ,");
     }
     if (model.phone != null)
     {
         strSql.Append("phone='"+model.phone+"',");
     }
     else
     {
         strSql.Append("phone= null ,");
     }
     if (model.zipCode != null)
     {
         strSql.Append("zipCode='"+model.zipCode+"',");
     }
     else
     {
         strSql.Append("zipCode= null ,");
     }
     if (model.address != null)
     {
         strSql.Append("address='"+model.address+"',");
     }
     else
     {
         strSql.Append("address= null ,");
     }
     if (model.email != null)
     {
         strSql.Append("email='"+model.email+"',");
     }
     else
     {
         strSql.Append("email= null ,");
     }
     if (model.photo != null)
     {
         strSql.Append("photo='"+model.photo+"',");
     }
     else
     {
         strSql.Append("photo= null ,");
     }
     if (model.passWord != null)
     {
         strSql.Append("passWord='******',");
     }
     else
     {
         strSql.Append("passWord= null ,");
     }
     if (model.type != null)
     {
         strSql.Append("type='"+model.type+"',");
     }
     else
     {
         strSql.Append("type= null ,");
     }
     if (model.admissionDate != null)
     {
         strSql.Append("admissionDate='"+model.admissionDate+"',");
     }
     else
     {
         strSql.Append("admissionDate= null ,");
     }
        			int n = strSql.ToString().LastIndexOf(",");
     strSql.Remove(n, 1);
     strSql.Append(" where id="+ model.id+"");
     int rowsAffected=DbHelperSQL.ExecuteSql(strSql.ToString());
     if (rowsAffected > 0)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(GS.Model.classdetail model)
 {
     StringBuilder strSql=new StringBuilder();
     StringBuilder strSql1=new StringBuilder();
     StringBuilder strSql2=new StringBuilder();
     if (model.name != null)
     {
         strSql1.Append("name,");
         strSql2.Append("'"+model.name+"',");
     }
     if (model.type != null)
     {
         strSql1.Append("type,");
         strSql2.Append("'"+model.type+"',");
     }
     if (model.teacher != null)
     {
         strSql1.Append("teacher,");
         strSql2.Append("'"+model.teacher+"',");
     }
     if (model.startTime != null)
     {
         strSql1.Append("startTime,");
         strSql2.Append("'"+model.startTime.ToShortDateString()+"',");
     }
     if (model.endTime != null)
     {
         strSql1.Append("endTime,");
         strSql2.Append("'" + model.endTime.ToShortDateString() + "',");
     }
     if (model.period != null)
     {
         strSql1.Append("period,");
         strSql2.Append("'"+model.period+"',");
     }
     if (model.credit != null)
     {
         strSql1.Append("credit,");
         strSql2.Append("'"+model.credit+"',");
     }
     if (model.location != null)
     {
         strSql1.Append("location,");
         strSql2.Append("'"+model.location+"',");
     }
     if (model.remark != null)
     {
         strSql1.Append("remark,");
         strSql2.Append("'"+model.remark+"',");
     }
     if (model.classId != null)
     {
         strSql1.Append("classId,");
         strSql2.Append("'"+model.classId+"',");
     }
     strSql.Append("insert into classDetail(");
     strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
     strSql.Append(")");
     strSql.Append(" values (");
     strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
     strSql.Append(")");
     strSql.Append(";select @@IDENTITY");
     object obj = DbHelperSQL.GetSingle(strSql.ToString());
     if (obj == null)
     {
         return 0;
     }
     else
     {
         return Convert.ToInt32(obj);
     }
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(GS.Model.student model)
 {
     StringBuilder strSql=new StringBuilder();
     StringBuilder strSql1=new StringBuilder();
     StringBuilder strSql2=new StringBuilder();
     if (model.stuId != null)
     {
         strSql1.Append("stuId,");
         strSql2.Append("'"+model.stuId+"',");
     }
     if (model.name != null)
     {
         strSql1.Append("name,");
         strSql2.Append("'"+model.name+"',");
     }
     if (model.sex != null)
     {
         strSql1.Append("sex,");
         strSql2.Append("'"+model.sex+"',");
     }
     if (model.majorId != null)
     {
         strSql1.Append("majorId,");
         strSql2.Append("'"+model.majorId+"',");
     }
     if (model.majorName != null)
     {
         strSql1.Append("majorName,");
         strSql2.Append("'"+model.majorName+"',");
     }
     if (model.colleage != null)
     {
         strSql1.Append("colleage,");
         strSql2.Append("'"+model.colleage+"',");
     }
     if (model.classType != null)
     {
         strSql1.Append("classType,");
         strSql2.Append("'"+model.classType+"',");
     }
     if (model.nation != null)
     {
         strSql1.Append("nation,");
         strSql2.Append("'"+model.nation+"',");
     }
     if (model.birthday != null)
     {
         strSql1.Append("birthday,");
         strSql2.Append("'"+model.birthday+"',");
     }
     if (model.certificateType != null)
     {
         strSql1.Append("certificateType,");
         strSql2.Append("'"+model.certificateType+"',");
     }
     if (model.certificateId != null)
     {
         strSql1.Append("certificateId,");
         strSql2.Append("'"+model.certificateId+"',");
     }
     if (model.degree != null)
     {
         strSql1.Append("degree,");
         strSql2.Append("'"+model.degree+"',");
     }
     if (model.placeOfWork != null)
     {
         strSql1.Append("placeOfWork,");
         strSql2.Append("'"+model.placeOfWork+"',");
     }
     if (model.workPhone != null)
     {
         strSql1.Append("workPhone,");
         strSql2.Append("'"+model.workPhone+"',");
     }
     if (model.phone != null)
     {
         strSql1.Append("phone,");
         strSql2.Append("'"+model.phone+"',");
     }
     if (model.zipCode != null)
     {
         strSql1.Append("zipCode,");
         strSql2.Append("'"+model.zipCode+"',");
     }
     if (model.address != null)
     {
         strSql1.Append("address,");
         strSql2.Append("'"+model.address+"',");
     }
     if (model.email != null)
     {
         strSql1.Append("email,");
         strSql2.Append("'"+model.email+"',");
     }
     if (model.photo != null)
     {
         strSql1.Append("photo,");
         strSql2.Append("'"+model.photo+"',");
     }
     if (model.passWord != null)
     {
         strSql1.Append("passWord,");
         strSql2.Append("'"+model.passWord+"',");
     }
     if (model.type != null)
     {
         strSql1.Append("type,");
         strSql2.Append("'"+model.type+"',");
     }
     if (model. admissionDate != null)
     {
         strSql1.Append(" admissionDate,");
         strSql2.Append("'"+model. admissionDate+"',");
     }
      		strSql.Append("insert into student(");
     strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
     strSql.Append(")");
     strSql.Append(" values (");
     strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
     strSql.Append(")");
     strSql.Append(";select @@IDENTITY");
     object obj = DbHelperSQL.GetSingle(strSql.ToString());
     if (obj == null)
     {
         return 0;
     }
     else
     {
         return Convert.ToInt64(obj);
     }
 }
Example #55
0
        public Item(GS.Map.World world, ItemTable definition)
            : base(world, definition.SNOActor)
        {
            SetInitialValues(definition);
            this.ItemHasChanges = true;//initial, this is set to true.
            // level requirement
            // Attributes[GameAttribute.Requirement, 38] = definition.RequiredLevel;

            Attributes[GameAttribute.Item_Quality_Level] = 1;
            if (Item.IsArmor(this.ItemType) || Item.IsWeapon(this.ItemType) || Item.IsOffhand(this.ItemType))
                Attributes[GameAttribute.Item_Quality_Level] = RandomHelper.Next(6);
            if (this.ItemType.Flags.HasFlag(ItemFlags.AtLeastMagical) && Attributes[GameAttribute.Item_Quality_Level] < 3)
                Attributes[GameAttribute.Item_Quality_Level] = 3;

            Attributes[GameAttribute.ItemStackQuantityLo] = 1;
            Attributes[GameAttribute.Seed] = RandomHelper.Next(); //unchecked((int)2286800181);

            RandomGenerator = new ItemRandomHelper(Attributes[GameAttribute.Seed]);
            RandomGenerator.Next();
            if (Item.IsArmor(this.ItemType))
                RandomGenerator.Next(); // next value is used but unknown if armor
            RandomGenerator.ReinitSeed();

            ApplyWeaponSpecificOptions(definition);
            ApplyArmorSpecificOptions(definition);
            ApplyDurability(definition);
            ApplySkills(definition);
            ApplyAttributeSpecifier(definition);

            int affixNumber = 1;
            if (Attributes[GameAttribute.Item_Quality_Level] >= 3)
                affixNumber = Attributes[GameAttribute.Item_Quality_Level] - 2;
            AffixGenerator.Generate(this, affixNumber);
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(GS.Model.examrecord model)
 {
     return dal.Update(model);
 }
Example #57
0
        public Item(GS.Map.World world, ItemTable definition, IEnumerable<Affix> affixList, string serializedGameAttributeMap)
            : base(world, definition.SNOActor)
        {
            SetInitialValues(definition);
            this.Attributes.FillBySerialized(serializedGameAttributeMap);
            this.AffixList.Clear();
            this.AffixList.AddRange(affixList);

            // level requirement
            // Attributes[GameAttribute.Requirement, 38] = definition.RequiredLevel;
            /*
            Attributes[GameAttribute.Item_Quality_Level] = 1;
            if (Item.IsArmor(this.ItemType) || Item.IsWeapon(this.ItemType) || Item.IsOffhand(this.ItemType))
                Attributes[GameAttribute.Item_Quality_Level] = RandomHelper.Next(6);
            if (this.ItemType.Flags.HasFlag(ItemFlags.AtLeastMagical) && Attributes[GameAttribute.Item_Quality_Level] < 3)
                Attributes[GameAttribute.Item_Quality_Level] = 3;
            */
            //Attributes[GameAttribute.ItemStackQuantityLo] = 1;
            //Attributes[GameAttribute.Seed] = RandomHelper.Next(); //unchecked((int)2286800181);
            /*
            RandomGenerator = new ItemRandomHelper(Attributes[GameAttribute.Seed]);
            RandomGenerator.Next();
            if (Item.IsArmor(this.ItemType))
                RandomGenerator.Next(); // next value is used but unknown if armor
            RandomGenerator.ReinitSeed();*/
        }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(GS.Model.examrecord model)
 {
     return dal.Add(model);
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(GS.Model.classdetail model)
 {
     return dal.Add(model);
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(GS.Model.classtype model)
 {
     return dal.Add(model);
 }