<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ~~~ /* Memento 備忘錄模式: 在不破壞封裝性的前提下,捕獲一個對象的內部狀態,并在該對象之外保存這個狀態。 這樣以后就可以將該對象恢復到原先保存的狀態 個人想法:將某個類的狀態(某些狀態,具體有該類決定)保存在另外一個類中 (代碼級別:提供一個函數能夠將狀態保存起來,返回出去),保存好狀態的類對象是管理類的成員, 原來的類需要恢復時,再從管理類中獲取原來的狀態 作者: HCLAC 日期: 20170309 */ package memento import ( "fmt" ) type GameRole struct { vit int atk int def int } func (g *GameRole) StateDisplay() { if g == nil { return } fmt.Println("角色當前狀態:") fmt.Println("體力:", g.vit) fmt.Println("攻擊:", g.atk) fmt.Println("防御:", g.def) fmt.Println("============") } func (g *GameRole) GetInitState() { if g == nil { return } g.vit = 100 g.atk = 100 g.def = 100 } func (g *GameRole) Fight() { if g == nil { return } g.vit = 0 g.atk = 0 g.def = 0 } func (g *GameRole) SaveState() RoleStateMemento { if g == nil { return RoleStateMemento{} } return RoleStateMemento{*g} } func (g *GameRole) RecoveryState(r RoleStateMemento) { if g == nil { return } g.vit = r.vit g.atk = r.atk g.def = r.def } type RoleStateMemento struct { GameRole } type RoleStateCaretaker struct { memento RoleStateMemento } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看